I'm building a form to enter new receipts. In order to normalize all the data, each line in the Inbound table is linked to a separate line in the Trucks table by a truck number.
When I open the receipts form, I want a message box to pop up asking if this will be a new truck number. If the user clicks yes, a separate form pops up requesting the information for that truck. If not, it just opens up the receipts form.
The way I have it set up right now isn't working. I tried setting up a textbox to pop up on load, which worked fine, but then if the user clicked Yes, the Receipts form would end up on top of the Trucks form. I tried sticking a "Select object" in there, but that didn't work. Maybe I didn't have it in the right place.
Either way, this is what I have right now. The code below is in the first field the cursor goes to. Unfortunately, it isn't working as I'd like. The same thing is happening as described above--the Trucks form doesn't get focus. I think, hypothetically, if the trucks form could get focus, it'd solve the problem because on closing the trucks form, it sets the trucks field in the Receipts form to whatever it is in the related field on the Trucks form.
Any ideas?
Thanks!
When I open the receipts form, I want a message box to pop up asking if this will be a new truck number. If the user clicks yes, a separate form pops up requesting the information for that truck. If not, it just opens up the receipts form.
The way I have it set up right now isn't working. I tried setting up a textbox to pop up on load, which worked fine, but then if the user clicked Yes, the Receipts form would end up on top of the Trucks form. I tried sticking a "Select object" in there, but that didn't work. Maybe I didn't have it in the right place.
Either way, this is what I have right now. The code below is in the first field the cursor goes to. Unfortunately, it isn't working as I'd like. The same thing is happening as described above--the Trucks form doesn't get focus. I think, hypothetically, if the trucks form could get focus, it'd solve the problem because on closing the trucks form, it sets the trucks field in the Receipts form to whatever it is in the related field on the Trucks form.
Code:
If IsNull([TRUCK]) Then
If (MsgBox("Will this be a new truck number?", 1) = 1) Then
DoCmd.OpenForm "TRUCKS", acNormal, "", "", , acNormal
DoCmd.SelectObject acForm, "TRUCKS", no
DoCmd.GoToControl "I/O"
Else
DoCmd.GoToControl "ID"
End If
End If
Any ideas?
Thanks!