How to check is combobox requery contains data (1 Viewer)

BJF

Registered User.
Local time
Today, 11:52
Joined
Feb 19, 2010
Messages
133
Hi All,

I have a combobox called BillTo, and after a selection is made, another combobox named ShipTo is requeried for corresponding records.
I made the following code, but it does not do what i want.
I am looking to populate bound Ship to fields with the info in the BillTo combobox upon requery of the ShipTo combobox being empty.
The problem seems to be that i dont know how to determine correctly if the query of ShipTo is or is not empty.
Please help!!!
by the way, the comboboxes are set up correctly and function fine when there are corresponding records.
Here is my code:


Private Sub BillTo_AfterUpdate()

ShipTo.Requery
ShipTo.SetFocus
ShipTo.Dropdown

If ShipTo.Value = 0 Then

ShipToCustomer = BillTo.Column(1)
ShipToAddress1 = BillTo.Column(2)
ShipToAddress2 = BillTo.Column(3)
ShipToAddress3 = BillTo.Column(4)
ShipToCity = BillTo.Column(5)
ShipToState = BillTo.Column(6)
ShipToZip = BillTo.Column(7)
ShipToCountry = BillTo.Column(8)
ShipToAttention = BillTo.Column(9)

Else
BillTo.SetFocus

End If

End Sub
 

Ranman256

Well-known member
Local time
Today, 11:52
Joined
Apr 9, 2015
Messages
4,339
Combo boxes are null if nothing is in them

If IsNull(ShipTo) then
 

BJF

Registered User.
Local time
Today, 11:52
Joined
Feb 19, 2010
Messages
133
Thanks Ranman,

but for some reason If isNull didn't work for me.
I ended up using .listcount = 1 and it did the trick.

BJF
 

Minty

AWF VIP
Local time
Today, 15:52
Joined
Jul 26, 2013
Messages
10,355
That would indicate you have a list box not a combo?

It would probably help in the long run if you used the Me.ShipTo reference to ensure you are referencing the current forms control and not the field values.
The Me. references the current form object.
 

Users who are viewing this thread

Top Bottom