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

How to make "Forms!" variable-able?

Status
Not open for further replies.

tobymom

Programmer
Aug 18, 2006
36
US
Dear Experts,

I want to make the following code as "Global Module".
However, I'm stuck with making "FormName" variable since it's connected with "Forms!".

Any ideas will be appreciated. Thanks.

BTW, how put following code inside a box? (Like many of you do nicely...)

--------------------
Sub OpenLinkedForm(FormName As String, FormParam As String, ParamField As Variant)

If CurrentProject.AllForms(FormName).IsLoaded Then
Forms!FormName.Recordset.FindFirst FormParam & "=" & ParamField & ""
Else

End If

DoCmd.OpenForm FormName, , , , , , ParamField

End Sub
---------------------
 
Use [ignore]
Code:
[/ignore] - see the Process TGML link below.

Code:
Sub OpenLinkedForm(FormName As String, FormParam As String, ParamField As Variant)

If CurrentProject.AllForms(FormName).IsLoaded Then
  Set frm=Forms(FormName)
  'Or simply Forms(FormName).Recordset ...
  frm.Recordset.FindFirst FormParam & "=" & ParamField & ""
Else
    
End If

DoCmd.OpenForm FormName, , , , , , ParamField

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top