Combo box selection to drive filter for query

thatlem

Registered User.
Local time
Yesterday, 19:37
Joined
Jan 29, 2009
Messages
115
I have a combo box which selects for facility. I want to use that selection to filter a query which is the data for a second combo box. The code properly identifies the selection from the facility, "DefinedUnitList" but I get a runtime error "The field is to small to accept the amount of data you attempted to add." I suspect the code is also incomplete.
I am using "DefinedUnitList" as the criteria filter in the query.

Private Sub Facility_AfterUpdate()

Dim stqueryname As String
Dim settempvar As String

stqueryname = qrys_FacilityUnit
settempvar = "DefinedUnitList"

Me.Facility = "DefinedUnitList"
docmd.requery (stqueryname)


End Sub

Any help would be appreciated. :banghead:
 
Check the Field FACILITY in the TABLE and make sure that the "FIELD SIZE" property for that field is not set too small.
 
I was making this wayyyyyyyyy to hard.

I stripped out the VBA and added a requery macro to execute afterupdate for the facility (first combo) using the second combo box name in the control source of the requery macro. I noted the first combo, [forms]![formname]![field] in the second combo source query criteria and wham bam works like a charm.
 

Users who are viewing this thread

Back
Top Bottom