Hi John, Thanks for answering.
I am trying intSex = DLookup("[SexID]", "[Sex]", "[SexDes] = 'Male'")
, but getting Error 94 "Invalid use of null"
Thanks,
Aldo.
"John W. Vinson" wrote:
> On Sat, 13 Jun 2009 10:27:01 -0700, Aldo <(E-Mail Removed)>
> wrote:
>
> >Hi guys,
> >How do I read a value from a table and store it in a variable using VBA?
> >I need to read the value using
> >SELECT Sex.SexID FROM Sex WHERE Sex.SexDes = "male"
> >Thanks in advance for any help,
> >Aldo.
>
> intSex = DLookUp("[SexID]", "[Sex]", "[SexDes] = 'male'")
>
> This take the place of your query. You could open the query and use a
> Recordset but that would involve several additional lines of code.
> --
>
> John W. Vinson [MVP]
>
|