Opening form from command button

djenkins1973

New member
Local time
Today, 17:29
Joined
Dec 3, 2019
Messages
6
Hi

I'm baffled!

I'm putting together a very simple (initially 1 table, 3 forms, 3 queries, 1 report) database and I'm struggling with something.

I've got all my functionality pretty much as I want it but I'm now trying to create a switchboard.


My main form is a search form that has a subform with data from a query. I have 2 unbound text boxes on the form which have code- Forms(“frmName”).Controls(“frmNameSub“).Form.Requery - in the afterupdate event to requery the subform.

If I open the form from the navigation pane it works but if I open it from a command button I get runtime-error 438 every time I enter text in either text box

If I debug when I get the error I can see "frmName"=empty if I hover over it.

any help greatly appreciated
 
Last edited:
Hi. Can you post a sample copy of your db with test data?
 
Hi. Thanks but no that didn't work.

For some reason the search boxes now don't work even when launching from the navigation pane. I don't get the runtime error but any input in those results in no returned data in the subform.
 
I changed it to

Code:
Option Compare Database
Private Sub txtManufacturerInput_AfterUpdate()
'Forms(“frmVehicleList”).Controls(“frmVehicleListSub“).Form.Requery
Me.qryVehicle_subform.Form.Requery
End Sub
Private Sub txtModelInput_AfterUpdate()
'Forms(“frmVehicleList”).Controls(“frmVehicleListSub“).Form.Requery
Me.qryVehicle_subform.Form.Requery
End Sub

That works via the switchboard button, both of them?

HTH
 
Last edited:
Thank you!

That works.... I've been playing too and

DoCmd.Requery (frmVehicleListSub)

also works
 
Hi. Glad to hear you got it sorted out. Good luck with your project.


Thanks for the assist, Gasman!
 

Users who are viewing this thread

Back
Top Bottom