Group:  Microsoft Access ยป microsoft.public.access.modulesdaovba
Thread: DoCmd.openForm Condition Type Mismatch

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

DoCmd.openForm Condition Type Mismatch
Ken 01.09.2006 15:13:02
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
Re: DoCmd.openForm Condition Type Mismatch
"Dirk Goldgar" <dg[ at ]NOdataSPAMgnostics.com> 01.09.2006 15:26:46
"Ken" <Ken[ at ]discussions.microsoft.com> wrote in message
news:AA289077-4835-4A61-B0A3-28A20857876B[ at ]microsoft.com
[Quoted Text]
> 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)


Re: DoCmd.openForm Condition Type Mismatch
Ken 01.09.2006 17:09:02
thats just embarassing, Thank you much

"Dirk Goldgar" wrote:

[Quoted Text]
> "Ken" <Ken[ at ]discussions.microsoft.com> wrote in message
> news:AA289077-4835-4A61-B0A3-28A20857876B[ at ]microsoft.com
> > 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)
>
>
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net