DLookup error

C

Charlie O'Neill

I am using Access 2007 on a Windows 7 Professional platform. I am using a
command button on click with an event procedure The following code produces
an error while debugging. The error states “Argument Not Optional†and
highlights the DLookup in the varX.


Private Sub Tax_ID_Click()

Dim varX As Variant
Dim homePath As String

varX = DLookup("[LC_Tax_ID2],q_Homes w Tax,
[HomeID]=[forms]![Members]![HomeID]")

homePath = "http://www.lakecopropappr.com/property-details.aspx?AltKey=" &
varX

Application.FollowHyperlink homePath

End Sub

Thanks Charlie
 
D

Douglas J. Steele

Your quotes are wrong.

varX = DLookup("[LC_Tax_ID2]","q_Homes w
Tax","[HomeID]=[forms]![Members]![HomeID]")

although you might have to use

varX = DLookup("[LC_Tax_ID2]","q_Homes w Tax","[HomeID]='" &
[forms]![Members]![HomeID] & "'")

(I'm assuming HomeID is a text field above.)
 

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

Similar Threads


Top