Type Mismatch when pulling value from Combo

D

Doctor

Not sure why I'm getting this error. I've used this code lots of times with
no worries.

This code pulls values from a zip code combo for City State and Country.
State and Country are combos as well on the form. City is a text box. When I
run the code, State and Country get properly populated; but City returns the
Type Mismatch error.

On Debugging, txt has a value of NULL, and cbo.Column(3) has a value of
"MILFORD".

Thanks in advance.

*****Code*****
Dim txt As TextBox
Dim cbo As ComboBox

Set cbo = Me.ChurchZip
Set txt = Me.ChurchCity

If Not IsNothing(Me.ChurchZip) Then
If Not cbo.Column(2) Then Me.CountryID = cbo.Column(2)
If Not cbo.Column(1) Then Me.StateID = cbo.Column(1)
If Not cbo.Column(3) Then txt = cbo.Column(3)
End If

Set txt = Nothing
Set cbo = Nothing
 
D

Doctor

Figured it out:

Line should be

If Not IsNull(cbo.Column(3)) Then txt = cbo.Column(3)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top