andreas_udby
Registered User.
- Local time
- Today, 17:03
- Joined
- May 7, 2001
- Messages
- 76
Okay, I know this is fairly simple, but I'm suffering from a case of "coder's block" in how to make this work.
I have a parent form, frmPatient, with a subform on it, called frmSubVendor. The main form gathers information about a patient and the subform shows the contact info for the vendor they have been referred to by the nurse. The parent/child forms are linked by a Long Integer field called vendorID by means of a non-visible text box (txtVendorID) on the parent form. When I manually change the vendorID value in that text box, the subform updates to show the vendor's info.
There is a button on frmPatient that says "Select Vendor". When clicked, this button opens up a modal form, frmSelectVendor, which contains a list box (lstVendor) showing a list of available vendors.
The user filters the list box by means of four dancing combos and then selects the vendor they need by clicking on it. At this point, the vendorID they selected should appear in txtVendorID on the main form, thanks to the following:
They then click a button (cmdSelectClose) that closes the modal form and returns them to the main form. In theory, the subform should be showing the vendor's info, since the value in txtVendorID has changed and there is an AfterUpdate() routine for the text box which performs a .Requery on the subform.
However, I can't seem to find a reliable way to pass the vendorID from the list box on the modal form to the text box on the main form (which is what the subform links to in order to pull the correct vendor record), and then make the subform update itself to show the selected vendor's information. I'm sure there is a very simple way to do this, but I'm just drawing a complete blank as to how to go about it. Any help is appreciated!
Thanks,
Andreas
I have a parent form, frmPatient, with a subform on it, called frmSubVendor. The main form gathers information about a patient and the subform shows the contact info for the vendor they have been referred to by the nurse. The parent/child forms are linked by a Long Integer field called vendorID by means of a non-visible text box (txtVendorID) on the parent form. When I manually change the vendorID value in that text box, the subform updates to show the vendor's info.
There is a button on frmPatient that says "Select Vendor". When clicked, this button opens up a modal form, frmSelectVendor, which contains a list box (lstVendor) showing a list of available vendors.
The user filters the list box by means of four dancing combos and then selects the vendor they need by clicking on it. At this point, the vendorID they selected should appear in txtVendorID on the main form, thanks to the following:
Code:
Private Sub lstVendor_Click()
Forms!frmVetInput!txtVendorID.Value = Me!lstVendor.Value
End Sub
However, I can't seem to find a reliable way to pass the vendorID from the list box on the modal form to the text box on the main form (which is what the subform links to in order to pull the correct vendor record), and then make the subform update itself to show the selected vendor's information. I'm sure there is a very simple way to do this, but I'm just drawing a complete blank as to how to go about it. Any help is appreciated!
Thanks,
Andreas
Last edited: