Re: DoCmd.openForm Condition Type Mismatch



"Ken" <Ken@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:AA289077-4835-4A61-B0A3-28A20857876B@xxxxxxxxxxxxx
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 & "'"

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

(please reply to the newsgroup)


.



Relevant Pages

  • Re: "Type Mismatch" error when trying to pass DAO.Tabledef to object function
    ... field1.GetFields'<< returns "Type mismatch" ... Dirk Goldgar, MS Access MVP ... (please reply to the newsgroup) ...
    (microsoft.public.access.modulesdaovba)
  • Re: How do I make a function run?
    ... > On another form I have a button that duplicates a record. ... Dirk Goldgar, MS Access MVP ... (please reply to the newsgroup) ...
    (microsoft.public.access.forms)
  • Re: query and dates...
    ... The Date function returns the current date; the Year function extracts the ... getting an answer in a newsgroup.) ... Microsoft Access MVP ... I get a type mismatch. ...
    (comp.databases.ms-access)
  • Re: Type mismatch in a criteria that used to work
    ... I will need to change this in my criteria. ... I get a type mismatch. ... Jerry Whittle, Microsoft Access MVP ... Please reply to the newsgroup. ...
    (microsoft.public.access.queries)
  • Re: loading game
    ... john wrote: ... > 0x80020005 type mismatch ... Check with Everquest tech support. ... newsgroup, please go here first for help in making a good post: ...
    (microsoft.public.windowsxp.general)