Re: Type Mismatch in dLookup

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks for the tip about the strings. Yes they did need to all be strings.

As far as strContact, I believe that you posted exactly what I already have
in my string. Perhaps you copied and pasted without making the changes? I've
done that before.

"Linq Adams via AccessMonster.com" wrote:

These things are always a hairball for me, getting the quotes correct, so I
keep a template to use. Try this:

strContact = DLookup("ContactID", "qryLLCAddressFillIn", "[ChurchID]=" &
Me.ContactChurch.Value And """[ContactLastName]=""" & """
Me.ContactLastName.Value """)

Also, be aware that in the statement

Dim strAddress1, strAddress2, strCity, strStateID, strState, strZip,
strPhone As String

only

strPhone

is being Dimmed as a String. Every other variable is being dimmed as Variant,
which is the default. To have them all declared as String you need to use

Dim strAddress1 As String, strAddress2 As String, strCity As String,
strStateID As String, strState As String, strZip As String, strPhone As
String

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000/2003

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200811/1


.



Relevant Pages

  • Re: Type Mismatch in dLookup
    ... Dim strAddress1, strAddress2, strCity, strStateID, strState, strZip, ... strPhone As String ... is being Dimmed as a String. ...
    (microsoft.public.access.formscoding)
  • Re: Type Mismatch in dLookup
    ... You have an extra single quote in the string. ... Dim strAddress1, strAddress2, strCity, strStateID, strState, strZip, ...
    (microsoft.public.access.formscoding)
  • Re: Type Mismatch in dLookup
    ... Dim strAddress1, strAddress2, strCity, strStateID, strState, strZip, ... strPhone As String ... is being Dimmed as a String. ...
    (microsoft.public.access.formscoding)
  • Parameter value
    ... It seems can execute the query. ... strPhone: String; ... The field 'Phone' is not a required field. ...
    (borland.public.delphi.database.ado)
  • Color
    ... I want to put some data of the string in RED color ...
    (microsoft.public.access.formscoding)