Form Is Not Recognized by Access

L

Larry B

I have been developing in VB 6.0 for a couple years. After
changing jobs, I have been asked to modify a VB application
written using Access 2002. I have added a new Form and a
new Module. When I run the program and try to look at
object properties, I get the following error message:

"<DCIM-PC can't find the form 'Update Report' referred to in a macro
expression or Visual Basic code.>"

when I break on

Select Case Forms![Update Report]!cboUpdateReportTriggerStatus.Text

Update Report is the Form I created. The line above is
contained in Module cmdUpdateReport.

The existing code contains a Form named DCI Simulator. In
module cmdDCISimulator there is a line of code with

Forms![DCI Simulator]!TransmitWindow.SetFocus

that works perfectly.

I am currently without an explanation. There are no
declarations of Forms or Modules anywhere, and everything
appears in the main project window. I'm probably missing
some fundamental concept of Access programming, but I can't
figure out what it might be.
 
S

Stuart McCall

Larry B said:
I have been developing in VB 6.0 for a couple years. After
changing jobs, I have been asked to modify a VB application
written using Access 2002. I have added a new Form and a
new Module. When I run the program and try to look at
object properties, I get the following error message:

"<DCIM-PC can't find the form 'Update Report' referred to in a macro
expression or Visual Basic code.>"

when I break on

Select Case Forms![Update Report]!cboUpdateReportTriggerStatus.Text

Update Report is the Form I created. The line above is
contained in Module cmdUpdateReport.

The existing code contains a Form named DCI Simulator. In
module cmdDCISimulator there is a line of code with

Forms![DCI Simulator]!TransmitWindow.SetFocus

that works perfectly.

I am currently without an explanation. There are no
declarations of Forms or Modules anywhere, and everything
appears in the main project window. I'm probably missing
some fundamental concept of Access programming, but I can't
figure out what it might be.

One important difference between VB and Access VBA is that in Access, when
you refer to textboxes and comboboxes you need to specify the Value property
instead of the Text prop. In Access, the Text prop is only valid while the
control has focus. So try changing your line:

Select Case Forms![Update Report]!cboUpdateReportTriggerStatus.Text

to:

Select Case Forms![Update Report]!cboUpdateReportTriggerStatus.Value

HTH
 
L

Larry B

Negative; Form has been closed and Focus set to previous Form.

Chris O'C via AccessMonster.com said:
Is the form Update Report already open when that line of code runs?

Chris
Microsoft MVP


Larry said:
I have been developing in VB 6.0 for a couple years. After
changing jobs, I have been asked to modify a VB application
written using Access 2002. I have added a new Form and a
new Module. When I run the program and try to look at
object properties, I get the following error message:

"<DCIM-PC can't find the form 'Update Report' referred to in a macro
expression or Visual Basic code.>"

when I break on

Select Case Forms![Update Report]!cboUpdateReportTriggerStatus.Text

Update Report is the Form I created. The line above is
contained in Module cmdUpdateReport.

The existing code contains a Form named DCI Simulator. In
module cmdDCISimulator there is a line of code with

Forms![DCI Simulator]!TransmitWindow.SetFocus

that works perfectly.

I am currently without an explanation. There are no
declarations of Forms or Modules anywhere, and everything
appears in the main project window. I'm probably missing
some fundamental concept of Access programming, but I can't
figure out what it might be.
 
L

Larry B

Thanks. I still get "<DCIM-PC can't find the form 'Update Report' referred
to in a macro expression or Visual Basic code.>" when I set a breakpoint.
It's as if the Form doesn't exist in the mind of Access (such as it is).

Stuart McCall said:
Larry B said:
I have been developing in VB 6.0 for a couple years. After
changing jobs, I have been asked to modify a VB application
written using Access 2002. I have added a new Form and a
new Module. When I run the program and try to look at
object properties, I get the following error message:

"<DCIM-PC can't find the form 'Update Report' referred to in a macro
expression or Visual Basic code.>"

when I break on

Select Case Forms![Update Report]!cboUpdateReportTriggerStatus.Text

Update Report is the Form I created. The line above is
contained in Module cmdUpdateReport.

The existing code contains a Form named DCI Simulator. In
module cmdDCISimulator there is a line of code with

Forms![DCI Simulator]!TransmitWindow.SetFocus

that works perfectly.

I am currently without an explanation. There are no
declarations of Forms or Modules anywhere, and everything
appears in the main project window. I'm probably missing
some fundamental concept of Access programming, but I can't
figure out what it might be.

One important difference between VB and Access VBA is that in Access, when
you refer to textboxes and comboboxes you need to specify the Value property
instead of the Text prop. In Access, the Text prop is only valid while the
control has focus. So try changing your line:

Select Case Forms![Update Report]!cboUpdateReportTriggerStatus.Text

to:

Select Case Forms![Update Report]!cboUpdateReportTriggerStatus.Value

HTH
 
L

Larry B

Okay; that got it. It was closing the Form prematurely. I'm on to a new set
of problems now. Thanks very much; I can now let the swelling go down...

Larry

Larry B said:
Thanks. I still get "<DCIM-PC can't find the form 'Update Report' referred
to in a macro expression or Visual Basic code.>" when I set a breakpoint.
It's as if the Form doesn't exist in the mind of Access (such as it is).

Stuart McCall said:
Larry B said:
I have been developing in VB 6.0 for a couple years. After
changing jobs, I have been asked to modify a VB application
written using Access 2002. I have added a new Form and a
new Module. When I run the program and try to look at
object properties, I get the following error message:

"<DCIM-PC can't find the form 'Update Report' referred to in a macro
expression or Visual Basic code.>"

when I break on

Select Case Forms![Update Report]!cboUpdateReportTriggerStatus.Text

Update Report is the Form I created. The line above is
contained in Module cmdUpdateReport.

The existing code contains a Form named DCI Simulator. In
module cmdDCISimulator there is a line of code with

Forms![DCI Simulator]!TransmitWindow.SetFocus

that works perfectly.

I am currently without an explanation. There are no
declarations of Forms or Modules anywhere, and everything
appears in the main project window. I'm probably missing
some fundamental concept of Access programming, but I can't
figure out what it might be.

One important difference between VB and Access VBA is that in Access, when
you refer to textboxes and comboboxes you need to specify the Value property
instead of the Text prop. In Access, the Text prop is only valid while the
control has focus. So try changing your line:

Select Case Forms![Update Report]!cboUpdateReportTriggerStatus.Text

to:

Select Case Forms![Update Report]!cboUpdateReportTriggerStatus.Value

HTH
 

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