Data on 1 Form to display on another

should be:
Code:
'DoCmd.OpenForm "frmVehicleMaintenance", , , "VehicleId" =  & me.txtborx_VehicleId
Hate to break the news to you again today, but your = should be inside the quotes:

DoCmd.OpenForm "frmVehicleMaintenance", , , "VehicleId=" & me.txtborx_VehicleId
 
You are using the quotes wrong. I am assuming that VehicleID is a number...in which case:

Code:
DoCmd.OpenForm "frmVehicleMaintenance", , , "VehicleId" = " & me.txtborx_VehicleId "
should be:
Code:
'DoCmd.OpenForm "frmVehicleMaintenance", , , "VehicleId" =  & me.txtborx_VehicleId


I tried that and I've attached the error
 

Attachments

  • problem.jpg
    problem.jpg
    100.1 KB · Views: 115
*headdesk* Ok, i'm stepping off this one...Cant seem to get the syntax right!
 
See my post just above.


Here it is, I tried changing (the one in red text) this

DoCmd.OpenForm "frmVehicleMaintenance", , , "VehicleId=" & Me.txtbox_VehicleId

to this

DoCmd.OpenForm "frmVehicleMaintenance", , , "txtbox_VehicleId=" & Me.txtbox_VehicleId

still same error message that I've attached here
 

Attachments

  • problem.jpg
    problem.jpg
    99.1 KB · Views: 112
Here it is, I tried changing (the one in red text) this

DoCmd.OpenForm "frmVehicleMaintenance", , , "VehicleId=" & Me.txtbox_VehicleId

to this

DoCmd.OpenForm "frmVehicleMaintenance", , , "txtbox_VehicleId=" & Me.txtbox_VehicleId

Why would you change the code I had? It didn't have txtbox_VehicleID = in it. I had:

DoCmd.OpenForm "frmVehicleMaintenance", , , "VehicleId=" & me.txtborx_VehicleId
NOT
txtbox_VehicleID - that goes in the second part AFTER the = and the &

SO USE THIS:

DoCmd.OpenForm "frmVehicleMaintenance", , , "VehicleId=" & me.txtborx_VehicleId
 
Why would you change the code I had? It didn't have txtbox_VehicleID = in it. I had:

DoCmd.OpenForm "frmVehicleMaintenance", , , "VehicleId=" & me.txtborx_VehicleId
NOT
txtbox_VehicleID - that goes in the second part AFTER the = and the &

SO USE THIS:

DoCmd.OpenForm "frmVehicleMaintenance", , , "VehicleId=" & me.txtborx_VehicleId


I only changed it to see if it would help solve my problem but it did not.
I tried what you suggested

DoCmd.OpenForm "frmVehicleMaintenance", , , "VehicleId=" & me.txtborx_VehicleId

and still doesn't work, still gives me compile error message.
 
I only changed it to see if it would help solve my problem but it did not.
I tried what you suggested

DoCmd.OpenForm "frmVehicleMaintenance", , , "VehicleId=" & me.txtborx_VehicleId

and still doesn't work, still gives me compile error message.
Perhaps because your control is not named txtborx_VehicleId and is named something else (see the possible typo of txtborx)

The field (VehicleId) needs to exist in the recordset of the form you are trying to open and the control needs to exist on the form you are opening from. Perhaps you may need to post your database so we can see exactly what you have.
 
Perhaps because your control is not named txtborx_VehicleId and is named something else (see the possible typo of txtborx)

The field (VehicleId) needs to exist in the recordset of the form you are trying to open and the control needs to exist on the form you are opening from. Perhaps you may need to post your database so we can see exactly what you have.


I did see that typo "txtborx" so I changed it to txtbox_VehicleId but still compile error
 
I guess posting the database should be the next step for me. I really don't know what to do next.
 

Attachments

Users who are viewing this thread

Back
Top Bottom