Re: Getting other field's value in the table

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



How about doing something like:

Dim x As Variant

x = DLookup("[UserID]", "tblUser", "[UserName]= '" & strUserName & "'")

If you have a match then x = UserID


Chris L wrote:
Hi,

The source code is roughly like this.

x = DLookup("[UserName]", "tblUser", "[UserName]= '" & strUserName & "'")

If IsNull(x) Then
'Add new UserName
Else
'I want to get the UserID of the existing UserName
End If

Regards,
Chris

What is the DLookUp() code you are using? Are you asking for the UserID?

[quoted text clipped - 11 lines]
Regards,
Chris

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com

.



Relevant Pages

  • Re: ListBox/ComboBox-to-TextBox question
    ... Just bound the dataset to the ListBox. ... Description, Status, UserName FROM "; ... Password, LoginName, Description, Status, UserName) VALUES (@UserID, ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Adding as option in a multiselect list box
    ... A part of this I haven't seen described yet is that you need something in the list box After Update event to allow for UserID being zero. ... UserName FROM tblUsers ORDER BY UserName ...
    (microsoft.public.access.forms)
  • Re: how to get users details
    ... Well Im using email address instead of username for a few reasons, ... is already the memid field there. ... UserID, at least for login purposes, rather than as a separate entity ... ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: Conditional display of records ...
    ... So in my query, I will map 'A' and 'B' for flag='Y' and userid (with which ... users logon) with the userid stored in table 'B'. ... The trick is to create a function that calls the username function and pass ... Function CheckFlag(strFlag As String) As Boolean ...
    (microsoft.public.access.formscoding)
  • Inserting IDs into a list box using ItemData function
    ... (userID, userName) ... the second table is notes (noteID, userID, notes). ... Loop ... .ItemData function as that does not seem to be avaliable ?!?! ...
    (microsoft.public.word.vba.general)