Using GoToRecord with DLookUp

  • Thread starter Thread starter Cathy via AccessMonster.com
  • Start date Start date
C

Cathy via AccessMonster.com

Hi
I'm fairly new to VB. Is there anyway to use DLookUp to return the value of
a field for a particular record? Can I use the GoToRecord Function in the
criteria?

I've tried using GoToRecord function before DLookUp thinking it would look up
the the value, but DLookUp always returns the first value rather than that
of the record I just went to.

Thanks,
Cathy
 
Cathy via AccessMonster.com said:
Hi
I'm fairly new to VB. Is there anyway to use DLookUp to return the
value of a field for a particular record? Can I use the GoToRecord
Function in the criteria?

I've tried using GoToRecord function before DLookUp thinking it would
look up the the value, but DLookUp always returns the first value
rather than that of the record I just went to.

Thanks,
Cathy

I'm not sure what you're asking. Could you describe in more detail what
you're trying to do, not just how you've attempted to do it? And then
show the code you tried.
 
Cathy, I use dlookup quite a bit. You basically find the record you want
using a search criteria as in "searchval", then in the "getfieldinfo" you
extract the particular field info you want out of the found record.

searchval = "[indexfield] = " & "'" & somevalue & "'"
getfieldinfo = DLookup("[anytablefield]", "nameoftable",
searchval)

/Jeff
 
Back
Top