DlookUp

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

Guest

im fairly new to access and ive never used dlookup before, this is what im hoping to to;
ive got a start up form "startup"
wich is bound to table "logon" wich contains 3 fields id(autonum), user (currentuser(), Dts(now()
what i want to do is if a user hasnt logged on before (user name not in table) i want them to be shown a short tutorial, before going on to the main switchboard can any one point me in the right direction? maybee a good site were i can read up
on dlookup

thanks in advance

john
 
Hi John

Here's an example:
DLookup("ID", "tblUsers", "[UserName]=CurrentUser()")
will terurn the ID field of the record in the table tblUsers, where the
value in the UserName field matches CurrentUser().

If such a record does not exist in the table, then it will return Null, so
any variable storing the result should be a variant.

Dim varUserID as Variant
varUserID = DLookup(...

You can use the IsNull function to check if Null has been returned:
If IsNull( varUserID) Then ...

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

john moore removeme said:
im fairly new to access and ive never used dlookup before, this is what im hoping to to;
ive got a start up form "startup"
wich is bound to table "logon" wich contains 3 fields id(autonum), user (currentuser(), Dts(now()
what i want to do is if a user hasnt logged on before (user name not in
table) i want them to be shown a short tutorial, before going on to the main
switchboard can any one point me in the right direction? maybee a good site
were i can read up
 
thanks for that graham.




-----Original Message-----
Hi John

Here's an example:
DLookup("ID", "tblUsers", "[UserName]=CurrentUser()")
will terurn the ID field of the record in the table tblUsers, where the
value in the UserName field matches CurrentUser().

If such a record does not exist in the table, then it will return Null, so
any variable storing the result should be a variant.

Dim varUserID as Variant
varUserID = DLookup(...

You can use the IsNull function to check if Null has been returned:
If IsNull( varUserID) Then ...

--
Good Luck!

Graham Mandeno [Access MVP]
Auckland, New Zealand

news:F159FEB4-87D6-4B50-B523-
(e-mail address removed)...
im fairly new to access and ive never used dlookup
before, this is what im
hoping to to;
ive got a start up form "startup"
wich is bound to table "logon" wich contains 3 fields
id(autonum), user
(currentuser(), Dts(now()
what i want to do is if a user hasnt logged on before
(user name not in
table) i want them to be shown a short tutorial, before going on to the main
switchboard can any one point me in the right direction? maybee a good site
were i can read up
on dlookup

thanks in advance

john


.
 
Back
Top