Set table default control from list box selection

thatlem

Registered User.
Local time
Today, 14:54
Joined
Jan 29, 2009
Messages
115
I have built a listbox which pulls several editable queries. One of the queries, "qrys_Facilities" is linked to "tbl_Facilities" table. This facility table is linked back to "tbl_Main", as the "Facility ID" field.

I would like to be able to open "qrys_Facilities" from the listbox and select which facility would be considered a default value to drop into the default values control in "tbl_Main" for the "Facility ID" field.

Additionally, I would like this selection to remain in an unbound field on an administrative set-up form, and ultimately be changable if necessary.

Any suggestions? :)
 
- you need a form with a listbox (YourList) showing the facilities
- on that form with the listbox you need a button to set the default value on the admin form with something like:
Code:
Private Sub cmdSetDefaultValue_Click()
    DoCmd.OpenForm "YourAdminForm", acDesign, , , , acHidden
    Forms!YourAdminForm!YourUnboundField.DefaultValue = """" & Me.YourList & """"
    DoCmd.Close acForm, "YourAdminForm", acSaveYes
End Sub
it does seem it would be simpler/better (?) to add a combobox to the admin form that people could select a value from that would be the default.
 

Users who are viewing this thread

Back
Top Bottom