DoCmd.openForm Condition Type Mismatch

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using:
DoCmd.OpenForm "Contacts", , , "LastName = '" & Me!List & "'" And
"CompanyName = '" & Me!List & "'"
on an update for a list box. It worked fine for just the last name, but I
get the first record encountered when there are duplicates. I wanted to add
the CompanyName and I get a type Mismatch but it is the same type as the last
name.

Any help is greatly appreciated.
Ken
 
Ken said:
I am using:
DoCmd.OpenForm "Contacts", , , "LastName = '" & Me!List & "'" And
"CompanyName = '" & Me!List & "'"
on an update for a list box. It worked fine for just the last name,
but I get the first record encountered when there are duplicates. I
wanted to add the CompanyName and I get a type Mismatch but it is the
same type as the last name.

Any help is greatly appreciated.
Ken

You've got your "And" outside the quotes, where it needs to go inside
them. Try this:

DoCmd.OpenForm "Contacts", , , _
"LastName = '" & Me!List & _
"' And CompanyName = '" & Me!List & "'"
 
thats just embarassing, Thank you much

Dirk Goldgar said:
You've got your "And" outside the quotes, where it needs to go inside
them. Try this:

DoCmd.OpenForm "Contacts", , , _
"LastName = '" & Me!List & _
"' And CompanyName = '" & Me!List & "'"

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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


Back
Top