Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

check form label in another database 1

Status
Not open for further replies.

jmodo

Programmer
Aug 2, 2006
43
US
I am opening a connection to another database and I need to check the text in one of the labels on form X.

I'm not sure how to go about getting a hold of the label object to check the text. Can I do this via connection properties, or do I have to open the form to get to the property? How would I do this?

Thanks!

J
 
using this stuff I guess?:

Dim ws As Workspace
Dim dblink As Database

Set ws = DBEngine.Workspaces(0)
Set dblink = ws.OpedDatabase(thePath)
dblink.???
 
Mainly from help:
Code:
Sub acAppX()
Dim acApp As Access.Application    ' Declare variable to hold the reference.
Dim frm As Object

Set acApp = CreateObject("Access.Application")
    ' You may have to set Visible property to True
    ' if you want to see the application.
acApp.Visible = True
acApp.OpenCurrentDatabase CurrentProject.Path & "\Tek-Tips.mdb"
For Each frm In acApp.CurrentProject.AllForms
    Debug.Print frm.Name
Next
acApp.Quit    ' When you finish, use the Quit method to close
Set acApp = Nothing    ' the application, then release the reference.
End Sub
 
J,

If you have not figured this out yet, would you mind telling me/us why you are trying to do this? I can't fathom a reason that you would need to do this. Its seems that there is something I don't get!?!?


C-D2
 
I'm still trying to get the handle on the caption of the label. I need more than just the form reference. the frm.Label does not return a correct reference.

C-D2 - there are a few versions out of a small database, and people decided to leave some of the old versions blank, so this is the only place that there is definitely the version number. Its not very good- i know! It wasn't my decision. :p
 
J,

OK, so you have multipule versions of the same database and you are trying to create a database that goes to the other databases to see what version of the database each person has installed?

I am totally lost.d I am not trying to be a pain, I am just trying to figure out what you are doing....

C-D2
 
It was intended as a start. Opening a form is the same as in the current database, except acApp goes in front of everything:
Code:
Sub acAppXz()
Dim acApp As Access.Application
Dim frm As Object
Dim ctl As Object

Set acApp = CreateObject("Access.Application")
acApp.Visible = True

acApp.OpenCurrentDatabase CurrentProject.Path & "\Tek-Tips.mdb"
acApp.DoCmd.OpenForm "FormX", acDesign
Debug.Print acApp.Forms![FormX].[lblLabel].Caption

DoCmd.Close acForm, "FormX"
acApp.Quit
Set acApp = Nothing
End Sub
 
It is best not to do this kind of thing unattended and, as always, back-ups are a good idea.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top