Sub-Form name as variable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am passing the name of a form to a with statement in a module and executing
stuff within that statement. This works fine. When I try to pass the name of
a sub-form, Access says it can't find the name. In the form [frm Inquiry New]
the code is:

'MeForm = "Forms![frm Inquiry New]![frm Management SubForm].Form!"
Call PeopleCheck(MeForm)

In the module the code reads:

Public Sub PeopleCheck(MeForm As String)
With Forms(MeForm)
If Not IsNull(.RepEID) Then ...etc.

I am guessing I need to put the main form name in front of the sub form
name, but it looks like it is already there. Any help with this syntax
problem would be appreciated. Thanks
 
Per apollo8359:
When I try to pass the name of
a sub-form, Access says it can't find the name. In the form [frm Inquiry New]

Tangential observation: save yourself some typing and also bulletproof your code
a little by not embedding spaces in object names.
 
Per (PeteCresswell):
a little by not embedding spaces in object names.

.... or any special characters.

Not typing the square brackets around names will reveal any violations - and
save typing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top