Results 1 to 6 of 6

Need Help for Dlookup function

  1. #1
    wasim_sono is offline Advanced Beginner
    Windows XP Access 2013 64bit
    Join Date
    May 2005
    Location
    Pakistan
    Posts
    73

    Need Help for Dlookup function

    Dear All

    I have fileds like Emp no, Name, Grade etc. in my Master table. I also have a
    transaction table 'TADA' having the same fileds. The form is based on
    transaction table 'TADA'. Now I used the dlookup function on 'Emp No' field
    of form as following.

    If IsNull(DLookup("[EmpNo]", "Combine", "[EmpNo]=forms![TADA]!EmpNo")) Then
    MsgBox "Please Enter Correct Emp No."
    EmpNo.Undo
    Cancel = True
    End If
    I'm getting error on last two Italic lines.
    Second I want that when a n emp no matched with master table then the name,


    grade and designation fileds of form populated with master table fileds of
    name, grade and designation and control transfer to naxt field. Is it
    possible or not? Please help.

    Thanx.

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275

    Re: Need Help for Dlookup function

    Quote Originally Posted by wasim_sono
    Code:
    If IsNull(DLookup("[EmpNo]", "Combine", "[EmpNo]=forms![TADA]!EmpNo")) Then
    Try this instead:

    Code:
    If IsNull(DLookup("[EmpNo]", "Combine", "[EmpNo]=" & Forms![TADA]!EmpNo)) Then
    As for the second part of your question, I am sorry, but I cannot quite understand what you are asking :?

  3. #3
    wasim_sono is offline Advanced Beginner
    Windows XP Access 2013 64bit
    Join Date
    May 2005
    Location
    Pakistan
    Posts
    73
    Dear Mathew

    The second part of my questin is that:

    When a master table field of emp no matched with the value entered by user on form then the remaining fields on form should populated automatically with the relevant fields of that record of master table.

    for example. a record in master table is as:

    Emp No Name Grade Designation
    23445 Wasim III Manager

    When a user entered 23445 in text box of the form then the Dlookup functions start and the matched the values in master table. After that the remaining text boxes of form should have the values of Wasim, III and manager respectively and the cursor should indicating in next text box.
    I hope is more descriptive and should understand.

    hopefully with a resulted reply.

    Thanx.

  4. #4
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    Wasim,

    If all of those values are already in your table, why not just bind that form to the table, and eliminate the need for DLookup (which can be slow) altogether?

    Patrick

  5. #5
    wasim_sono is offline Advanced Beginner
    Windows XP Access 2013 64bit
    Join Date
    May 2005
    Location
    Pakistan
    Posts
    73
    Dear Mathew thanx for the reply.

    You are right. But I need to creat a transaction table just like Master -detail. but I have no idea to how create this. Actually for time saving of user I want to use it.

  6. #6
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    Quote Originally Posted by wasim_sono
    You are right. But I need to creat a transaction table just like Master -detail. but I have no idea to how create this. Actually for time saving of user I want to use it.
    Having tables with redundant data is a big design no-no. From your last post, it appears to me that you need to take another look at your schema.

    Can you briefly outline the tables in your app?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Is there a function to do this....
    By Nowherefast in forum Access
    Replies: 2
    Last Post: 12-31-2008, 08:08 AM
  2. SELECT FUNCTION help please
    By scott munkirs in forum Queries
    Replies: 0
    Last Post: 10-17-2006, 07:44 AM
  3. I have Problem in processing Dlookup Function
    By Katada in forum Programming
    Replies: 2
    Last Post: 04-23-2006, 12:07 AM
  4. transferspreadsheet function
    By jeffj in forum Import/Export Data
    Replies: 3
    Last Post: 03-13-2006, 11:59 AM
  5. Replies: 1
    Last Post: 01-10-2006, 12:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Tech Forums: Microsoft Office Forums