Objective: Form will provide the correct Unit of Measure and corresponding quantity per container using the item selected in a combo box. The units of measure are in a separate table.
Problem: The dlookup is looking up user id instead of item. I THINK it is because the bound column
Structure: Step 1) The user selects his/her name from a Combo box #1 Step 2) Combo box #2 will only show location assigned to the user -- user selects location. Step 3) Combo box #3 will only show items store in that location -- user selects item
Code for combo box #3
Private Sub Item_GotFocus()
Dim user_filter, location_filter As String
user_filter = Me.Count_By
location_filter = Me.Location
With Me.Item
.RowSource = "SELECT WeeklyCountOptions.User, WeeklyCountOptions.Location, WeeklyCountOptions.Item" _
& " FROM WeeklyCountOptions" _
& " WHERE (((WeeklyCountOptions.User)='" & user_filter & "') AND ((WeeklyCountOptions.Location)='" & location_filter & "'));"
' by having here the property sheet is ignore
.BoundColumn = 1
.ColumnCount = 3
.ColumnWidths = "0in.;0in.;1in."
End With
End Sub
Code for dlookup
Private Sub Whole_Count_GotFocus()
Dim Item_Filter As String
DoCmd.OpenTable "item_Detail"
Item_Filter = "[ItemId]=" & "'" & Me.Item.Value & "'"
MsgBox (Item_Filter) ' just for testing need to delete
Me.Units_in_UOM = DLookup("[QPC]", "[Item_Detail]", Item_Filter)
End Sub
What can I do to fix it this?