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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modify form in another database

Status
Not open for further replies.

kuanli

Technical User
Jan 28, 2002
22
CA
Could someone please show me how I can modify the rowSource of a form in aother database using VB? I'm in desperate need.

Thanks in advance.
 
Forms don't have ROWSource properties.

So the simple answer is NO.

What is it that you are actually wanting to do ?



G LS
 
Thanks for the reply.

I want to modify the rowsource of a control in a form.

I got something like this:

Dim appAccess As Access.Application
Dim strDB As String
Dim strFormName As String

' Initialize string to database path.
strDB = "c:\AA_xx\Workplan.mdb"
' Initialize string to Form name.
strFormName = "frmWorkPlan"

Set appAccess = _
CreateObject("Access.Application")

' Open database in Microsoft Access.
appAccess.OpenCurrentDatabase strDB

' Open form
' appAccess.DoCmd.OpenForm strFormName

Forms(0).Controls("status").RowSource = "inProgress"

But the last line didn't work. Access complains that the form cannot be found.

Kuan
 
Why are you using Forms(0) when you know the name of the form ?
Why not use Forms!frmWorkPlan!Status.RowSource =

Is Status a Combo Box control ?

Is inProgress the name of a Table or Query ?


Is this remote database open at the time you are running this code - or are you attempting to edit the design of a closed form inside a closed database ?


G LS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top