In your original code you repeated 'Private Sub cbxBin1_GotFocus()' twice causing an error. In the 2nd one you had...
Code:
Private Sub cbxBin1_GotFocus()
Me.cbxBin1.Dropdown
End Sub
I assume I need to move...
Code:
Me.cbxBin1.Dropdown
into the first GotFocus, where abouts should I put it in the code below?
Code:
Private Sub cbxBin1_GotFocus()If Me.NewRecord Then Me.cbxBin1.RowSource = "SELECT tblAllocatedBin.allocated_bin_id, tblBin.bin, tblBinType.bin_type " & _
"FROM tblBinType RIGHT JOIN (tblBin LEFT JOIN (AllocatedUNION RIGHT JOIN tblAllocatedBin ON " & _
"AllocatedUNION.AllocatedBin = tblAllocatedBin.allocated_bin_id) ON tblBin.bin_id = tblAllocatedBin.allocated_bin) ON " & _
"tblBinType.bin_type_id = tblAllocatedBin.allocated_bin_type " & _
"WHERE AllocatedUNION.AllocatedBin Is Null " & _
"ORDER BY tblBinType.bin_type, tblBinType.priority;"
Me.cbxBin2.RowSource = "SELECT tblAllocatedBin.allocated_bin_id, tblBin.bin, tblBinType.bin_type " & _
"FROM tblBinType RIGHT JOIN (tblBin LEFT JOIN (AllocatedUNION RIGHT JOIN tblAllocatedBin ON " & _
"AllocatedUNION.AllocatedBin = tblAllocatedBin.allocated_bin_id) ON tblBin.bin_id = tblAllocatedBin.allocated_bin) ON " & _
"tblBinType.bin_type_id = tblAllocatedBin.allocated_bin_type " & _
"WHERE AllocatedUNION.AllocatedBin Is Null " & _
"ORDER BY tblBinType.bin_type, tblBinType.priority;"
Else
Me.cbxBin1.RowSource = "SELECT tblAllocatedBin.allocated_bin_id, tblBin.bin, tblBinType.bin_type " & _
"FROM tblBinType RIGHT JOIN (tblBin LEFT JOIN (AllocatedUNION RIGHT JOIN tblAllocatedBin ON " & _
"AllocatedUNION.AllocatedBin = tblAllocatedBin.allocated_bin_id) ON tblBin.bin_id = tblAllocatedBin.allocated_bin) ON " & _
"tblBinType.bin_type_id = tblAllocatedBin.allocated_bin_type " & _
"WHERE (((AllocatedUNION.AllocatedBin)=[Forms]![frmProduct]![allocated_bin_1] Or (AllocatedUNION.AllocatedBin) Is Null)) " & _
"ORDER BY tblBinType.bin_type, tblBinType.priority;"
Me.cbxBin2.RowSource = "SELECT tblAllocatedBin.allocated_bin_id, tblBin.bin, tblBinType.bin_type " & _
"FROM tblBinType RIGHT JOIN (tblBin LEFT JOIN (AllocatedUNION RIGHT JOIN tblAllocatedBin ON " & _
"AllocatedUNION.AllocatedBin = tblAllocatedBin.allocated_bin_id) ON tblBin.bin_id = tblAllocatedBin.allocated_bin) ON " & _
"tblBinType.bin_type_id = tblAllocatedBin.allocated_bin_type " & _
"WHERE (((AllocatedUNION.AllocatedBin)=[Forms]![frmProduct]![allocated_bin_2] Or (AllocatedUNION.AllocatedBin) Is Null)) " & _
"ORDER BY tblBinType.bin_type, tblBinType.priority;"
End If
Me.cbxBin1.Requery
Me.cbxBin2.Requery
End Sub