Results 1 to 6 of 6
  1. #1
    Join Date
    May 2005
    Posts
    54

    Unanswered: Dlookup function

    I'm using Dlookup function im my form.
    I have a master table named 'AccountNo' with having a text field named as 'AccNo'. Now I have another transaction table named as 'Bill' having many fields and one of is 'AccNo'.
    Now I have design a form on the basis of Transaction table 'Bill'.
    Now I want to authenticate the account no entered in form field with master table field 'AccountNo'.
    any help pls.

    Wasim

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi Wasim

    Not certain about what you want precisely however writing a DLookup is a bit like writing SQL but without the clause key words.
    Code:
    "SELECT MyField FROM MyTable WHERE MyOtherField = '" & Me.MyTextBox & "'"
    becomes
    Code:
     DLookup("MyField", "MyTable", "MyOtherField = '" & Me.MyTextBox & "'")
    Try checking out help for more info.
    Last edited by pootle flump; 12-19-05 at 06:40.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    May 2005
    Posts
    54
    Thanx Pootle for ur reply.
    I got something like
    If IsNull(DLookup("[AccNo]", "AccountNo", "AccNo=forms![Bill]!AccNo")) Then
    MsgBox "Please Enter Correct Account No."
    AccNo.Undo
    Cancel = True
    End If

    and it is working perfectly. However I will try ur text.

    Thanx a lot.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by wasim_sono
    Thanx Pootle for ur reply.
    I got something like
    If IsNull(DLookup("[AccNo]", "AccountNo", "AccNo=forms![Bill]!AccNo")) Then
    MsgBox "Please Enter Correct Account No."
    AccNo.Undo
    Cancel = True
    End If

    and it is working perfectly.
    Hi Wasim
    I doubt that very much. Perhaps:
    Code:
     IsNull(DLookup("[AccNo]", "AccountNo", "AccNo= " & forms![Bill]!AccNo))
    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  5. #5
    Join Date
    Mar 2005
    Posts
    261
    Quote Originally Posted by pootle flump
    Hi Wasim
    I doubt that very much. Perhaps:
    Code:
     IsNull(DLookup("[AccNo]", "AccountNo", "AccNo= " & forms![Bill]!AccNo))
    HTH
    ... Not strictly true. You can use Jet/Access expressions in the domain aggregate functions, so Wasim's original version is OK.

    However, it is "generally" considered to be better programming practice to use Pootle's version.

  6. #6
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Quote Originally Posted by waynephillips
    ... Not strictly true. You can use Jet/Access expressions in the domain aggregate functions, so Wasim's original version is OK.
    Oops - good point - force of habit from years of building strings
    Testimonial:
    pootle flump
    ur codings are working excelent.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •