Filling in a form with an if statement

C

Charlieo

What did I do wrong?

Private Sub AdvertiserCombo_AfterUpdate()
If ([queries].[q_Advertiser_ID].[Billing_Name]) Is Null Then
Me.ID.Value = Me.AdvertiserCombo.Column(1)
Me.AdvertiserName.Value = Me.AdvertiserCombo.Column(0)
Me.AdvertiserAddress.Value = Me.AdvertiserCombo.Column(2)
Me.AdvertiserCity.Value = Me.AdvertiserCombo.Column(3)
Me.AdvertiserState.Value = Me.AdvertiserCombo.Column(4)
Me.AdvertiserZip.Value = Me.AdvertiserCombo.Column(5)
Else
Me.ID.Value = Me.AdvertiserCombo.Column(1)
Me.AdvertiserName.Value = [queries].[q_Advertiser ID].[Billing Name]
Me.AdvertiserAddress.Value = [queries].[q_Advertiser ID].[Billing Address]
Me.AdvertiserCity.Value = [queries].[q_Advertiser ID].[Billing City]
Me.AdvertiserState.Value = [queries].[q_Advertiser ID].[Billing St]
Me.AdvertiserZip.Value = [queries].[q_Advertiser ID].[Billing Zip]
End If
End Sub

Charlie
 
J

Jeanette Cunningham

Hi Charlieo,
the way you have set up the Is Null check is wrong.
Try it like this-->

If IsNull([queries].[q_Advertiser_ID].[Billing_Name]) Then


There is a VBA function called IsNull, to use as shown above.

There is a criteria of Is Null that is used in queries. You must use the
correct one for the occasion.



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
C

Charlie O'Neill

Thank you, your answer solve the problem.
Charlie
Jeanette Cunningham said:
Hi Charlieo,
the way you have set up the Is Null check is wrong.
Try it like this-->

If IsNull([queries].[q_Advertiser_ID].[Billing_Name]) Then


There is a VBA function called IsNull, to use as shown above.

There is a criteria of Is Null that is used in queries. You must use the
correct one for the occasion.



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Charlieo said:
What did I do wrong?

Private Sub AdvertiserCombo_AfterUpdate()
If ([queries].[q_Advertiser_ID].[Billing_Name]) Is Null Then
Me.ID.Value = Me.AdvertiserCombo.Column(1)
Me.AdvertiserName.Value = Me.AdvertiserCombo.Column(0)
Me.AdvertiserAddress.Value = Me.AdvertiserCombo.Column(2)
Me.AdvertiserCity.Value = Me.AdvertiserCombo.Column(3)
Me.AdvertiserState.Value = Me.AdvertiserCombo.Column(4)
Me.AdvertiserZip.Value = Me.AdvertiserCombo.Column(5)
Else
Me.ID.Value = Me.AdvertiserCombo.Column(1)
Me.AdvertiserName.Value = [queries].[q_Advertiser ID].[Billing Name]
Me.AdvertiserAddress.Value = [queries].[q_Advertiser ID].[Billing Address]
Me.AdvertiserCity.Value = [queries].[q_Advertiser ID].[Billing City]
Me.AdvertiserState.Value = [queries].[q_Advertiser ID].[Billing St]
Me.AdvertiserZip.Value = [queries].[q_Advertiser ID].[Billing Zip]
End If
End Sub

Charlie
 

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