VBA Syntax Question

M

Mike

Hello.

I am working on a database that I inherited and am
changing some things around. In the original database
there is an "OK" button that will produce a report. One
of the lines of code associtated with this task is:

Set frm = Forms!frmSelectClearance

In the dbase I am redoing, I have put this form
(frmSelectClearance) a subform on a tab on another form
(frmReportsMenu). Now when I click the "OK" button I get
the error: "Microsoft Access can't find the
form 'frmSelectClearance' referred to in a macro
expression or Visual Basic code"

I assume its looking for the form, but since its a subform
now of frmReportsMenu, it doesn't know where to look. How
do I overcome this (i.e. what is the syntax to tell it
where to look)?

Any assistance would be greatly apppreciated.

Thanks in advance,

m.
 
D

Dev Ashish

I assume its looking for the form, but since its a subform
now of frmReportsMenu, it doesn't know where to look. How
do I overcome this (i.e. what is the syntax to tell it
where to look)?

Set frm = Forms!frmReportsMenu("SubformName")Form

You'll have to open reportsMenu in Design mode to see what name got
assigned to frmSelectClearance.

Also see

[ http://www.mvps.org/access/forms/frm0031.htm ]

-- Dev
 
E

Emilia Maxim

---------- "Mike said:
Hello.

I am working on a database that I inherited and am
changing some things around. In the original database
there is an "OK" button that will produce a report. One
of the lines of code associtated with this task is:

Set frm = Forms!frmSelectClearance

In the dbase I am redoing, I have put this form
(frmSelectClearance) a subform on a tab on another form
(frmReportsMenu). Now when I click the "OK" button I get
the error: "Microsoft Access can't find the
form 'frmSelectClearance' referred to in a macro
expression or Visual Basic code"

Mike,

the Forms collection contains at any given time the open forms.
However, frmSelectClearance is not an open form, it is the source
object of a control on a form.

As to how to solve this, it depends on what would you want to achieve.
Please post the whole code of the Click event and give some more
details.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 

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

Top