Bills form run time error

B

Bill_De

I Have a data base form that is tabbed to have several sub forms. I created
the first form "Contacts" and then created a form called "frmRegistration".
In
the registration form I have a combo box that I can select a building and
room number and then a query updates the table and removes the Check box
which is the availability or not.

Here is my problem I draged the frmRegistration over to the tab in the frm
contacts to make a sub form in tab 2. The frmContacts is in tab 1. If I fill
in all of the information in the registration form except a building and room
then click save the form saves the information and closes with no problem. If
however I enter the information and then click on the combo box named
Combo54, and select a building and room, then click save I get the following
error:

Run time Error 2450
Microsoft Access can't find the Form 'frmRegistration' referred to in a
Macro Expression or Visual Basic Code.

I then click on the debug button and the VB editor opens to my Combo54 code:

Private Sub Combo54_Exit (Cancel as Integer)
Dim db as DAO.Database
Dim qdf as QeuryDEF
Set qdf=db.Query Defs("Reserve Room")
{Yellow Highlight} qdf.Parameters(0). Value= Eval(qdf.Parameters(0).Name)
qdf.Execute dbFail on Error
Me.Combo54 Requery

When I put the cursor on the qdf.Parameters(0).Value I get the following
experssion: qdf.Parameters(0).Value=empty
When I put the cursor on the qdf.Parameters(0).Name I get the following
expression: qdf.Parameters(0).Name="[Forms]![frmRegistration]![Combo54]"

Any advise you can give me to correct this problem would be great. A note
the forms worked perfect (ran, updated, removed the selected room) until I
draged the registration form over to the second tab and made it a sub form of
the Contacts form. I am looking to remove the run time error so the form
works when draged over to the tab and made a subform

Thanks
Bill
 
X

xRoachx

I'm not sure this is the problem but I noticed a typo in declaring your
variables.

Dim qdf as QeuryDEF --> Dim qdf as DAO.Querydef
Set qdf=db.Query Defs("Reserve Room") --> Remove space btwn query and def
 
B

Bill_De

I changed that typo and that did not solve the problem still getting the same
run time error. As I am new to VB I am having trouble understanding this
problem. As I said prior the form ran ok until I dragged it over to the tab
now it does not recognize the form. I copied the VB code from the data base
exactly as it is written and have attached it below:
Private Sub Combo54_Exit(Cancel As Integer)
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Set db = CurrentDb()
Set qdf = db.QueryDefs("Reserve Room")
{This is where the error is}qdf.Parameters(0).Value =
Eval(qdf.Parameters(0).Name)
qdf.Execute dbFailOnError
Me.Combo54.Requery

When cursor is placed over highlighted area the following opens:

Qdf.Parameters(0).value=Empty
Qdf.Parameter(0).Name=â€[Forms]![frmRegistration]![combo54]â€

Any advice on what to do next would be great as I am lost here.
Thanks

Bill_De said:
I Have a data base form that is tabbed to have several sub forms. I created
the first form "Contacts" and then created a form called "frmRegistration".
In
the registration form I have a combo box that I can select a building and
room number and then a query updates the table and removes the Check box
which is the availability or not.

Here is my problem I draged the frmRegistration over to the tab in the frm
contacts to make a sub form in tab 2. The frmContacts is in tab 1. If I fill
in all of the information in the registration form except a building and room
then click save the form saves the information and closes with no problem. If
however I enter the information and then click on the combo box named
Combo54, and select a building and room, then click save I get the following
error:

Run time Error 2450
Microsoft Access can't find the Form 'frmRegistration' referred to in a
Macro Expression or Visual Basic Code.

I then click on the debug button and the VB editor opens to my Combo54 code:

Private Sub Combo54_Exit (Cancel as Integer)
Dim db as DAO.Database
Dim qdf as QeuryDEF
Set qdf=db.Query Defs("Reserve Room")
{Yellow Highlight} qdf.Parameters(0). Value= Eval(qdf.Parameters(0).Name)
qdf.Execute dbFail on Error
Me.Combo54 Requery

When I put the cursor on the qdf.Parameters(0).Value I get the following
experssion: qdf.Parameters(0).Value=empty
When I put the cursor on the qdf.Parameters(0).Name I get the following
expression: qdf.Parameters(0).Name="[Forms]![frmRegistration]![Combo54]"

Any advise you can give me to correct this problem would be great. A note
the forms worked perfect (ran, updated, removed the selected room) until I
draged the registration form over to the second tab and made it a sub form of
the Contacts form. I am looking to remove the run time error so the form
works when draged over to the tab and made a subform

Thanks
Bill
 
B

Bill_De

Another note on this to help you out. The combo box is in the form
"frmRegistration". Prior to placing the form in the tab when I clicked on the
combo box it would show the building and room. When I selected an item it
would place it in a text box on the form and then would remove it from the
list. All of this worked great as I said. Then when I left clicked and
dragged the form over to the tab control which at the time only had one other
form the "frmContacts" in it then went to assign a room after clicking on the
room I wanted I then clicked the save button and got the run time error
"could not find the form "frmRegistration". I get this error message even if
I click on the "X" to close the form.

Bill_De said:
I changed that typo and that did not solve the problem still getting the same
run time error. As I am new to VB I am having trouble understanding this
problem. As I said prior the form ran ok until I dragged it over to the tab
now it does not recognize the form. I copied the VB code from the data base
exactly as it is written and have attached it below:
Private Sub Combo54_Exit(Cancel As Integer)
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Set db = CurrentDb()
Set qdf = db.QueryDefs("Reserve Room")
{This is where the error is}qdf.Parameters(0).Value =
Eval(qdf.Parameters(0).Name)
qdf.Execute dbFailOnError
Me.Combo54.Requery

When cursor is placed over highlighted area the following opens:

Qdf.Parameters(0).value=Empty
Qdf.Parameter(0).Name=â€[Forms]![frmRegistration]![combo54]â€

Any advice on what to do next would be great as I am lost here.
Thanks

Bill_De said:
I Have a data base form that is tabbed to have several sub forms. I created
the first form "Contacts" and then created a form called "frmRegistration".
In
the registration form I have a combo box that I can select a building and
room number and then a query updates the table and removes the Check box
which is the availability or not.

Here is my problem I draged the frmRegistration over to the tab in the frm
contacts to make a sub form in tab 2. The frmContacts is in tab 1. If I fill
in all of the information in the registration form except a building and room
then click save the form saves the information and closes with no problem. If
however I enter the information and then click on the combo box named
Combo54, and select a building and room, then click save I get the following
error:

Run time Error 2450
Microsoft Access can't find the Form 'frmRegistration' referred to in a
Macro Expression or Visual Basic Code.

I then click on the debug button and the VB editor opens to my Combo54 code:

Private Sub Combo54_Exit (Cancel as Integer)
Dim db as DAO.Database
Dim qdf as QeuryDEF
Set qdf=db.Query Defs("Reserve Room")
{Yellow Highlight} qdf.Parameters(0). Value= Eval(qdf.Parameters(0).Name)
qdf.Execute dbFail on Error
Me.Combo54 Requery

When I put the cursor on the qdf.Parameters(0).Value I get the following
experssion: qdf.Parameters(0).Value=empty
When I put the cursor on the qdf.Parameters(0).Name I get the following
expression: qdf.Parameters(0).Name="[Forms]![frmRegistration]![Combo54]"

Any advise you can give me to correct this problem would be great. A note
the forms worked perfect (ran, updated, removed the selected room) until I
draged the registration form over to the second tab and made it a sub form of
the Contacts form. I am looking to remove the run time error so the form
works when draged over to the tab and made a subform

Thanks
Bill
 

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