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

How do i pass and use arguments to determine which table to load...

Status
Not open for further replies.

Eric6

Programmer
Jun 11, 2002
54
CA
Hello,
i'm trying to make a form that will load
either one of 2 tables... (As the form's source)

I figured i would push a button (on formA)
that button has the openform function
i would use that function to pass an argument to formB
to determine which table the form would use...

in formB in the Form_Open function
i would use the argument to determine which table
formB would open and use.

a better alternative
would be to create a "global" variable
that will be use as the table name
throughout the code file...

here is what i have so far:
In FormA:
Public Sub MaintainFunctionList_Click()
DoCmd.OpenForm "MaintainLists", , , , , , "Function"

In FormB:
Dim TableName AS String
TableName = *Argument*

Public Sub Form_Open(Cancel As Integer)
DoCmd.OpenTable TableName


how can i pass the argument "Function"
to FormB so i can use it as a string and assign it to a variable?

i would greatly appreciate help
thank you
 
In Form B check OpenArgs.

Public Sub Form_Open(Cancel As Integer)

Dim openingArgs As String
If Not (IsNull(Me.OpenArgs) = True) Then
openingArgs = Me.OpenArgs
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top