Results 1 to 8 of 8
  1. #1
    ballj_35 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2010
    Location
    Columbus Oh
    Posts
    25

    Find Record Button on Form and return data to the form

    I have been using Combo Boxes and now I need to understand how to create a Find Button on the same form. What I would like to do is allow the user to enter a value to get a Member Bond Number (format: double). They would enter a value and press the FIND button. If the record is found move the MBR_Last_Name, etc.. to the form. If the record is not found, display an error message.


    Then if the record is found, allow the user to enter a Term_Date value on the form. When they click on the SAVE button, then move the form fields to another tables field and do an INSERT.
    Can someone plz give me some ideas, since I am confused on all of this. I have used Combo Boxes before to get data and update, but now I have to try this without those functions.
    Thanx in advance.

    Jerry

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    One way is a simple DLookup function.

    If Not IsNull(DLookup("[Member Bond Number]", "table name", "[field name]='" & Me.textboxname & "'")) Then
    'do something
    End If

    Example assumes text datatype. If not, remove the apostrophe delimiters. Dates use #, numbers nothing.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ballj_35 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2010
    Location
    Columbus Oh
    Posts
    25
    I am not having success with this command. Found documentation where it stated to put this in the Control Source, which is what I am doing and I am just getting errors. I have the command as follows:

    =DLookUp("[MBR_Last_Name]","Mbr_Tbl","[MBR_Bond_Nbr]= Form![txtBndNbr]")

    Also I need to return 3 fields from the Mbr_Tbl to fields on the form. From what I have read, this is command is only going to return the MBR_LastName. Am I understanding this correctly?

  4. #4
    ballj_35 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2010
    Location
    Columbus Oh
    Posts
    25

    Find Record Button on Form and return data to the form

    I am attaching the DB for review. I have created a query FindBondNumber, that prompts the user for a value and get's it from the DB. If I could figure out how to do error handling for not found and move the data returned to the form fields, then I may be okay.
    Once the user clicks on SAVE, then I will try to figure out how to execute an INSERT into the Transfer table. Any ideas, suggestions or places I can read to get this done?
    Thanx in advance.

    Jerry
    Attached Files Attached Files

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    Look at my example again. The variable must be concatenated. Reference to control on form is a variable.

    =DLookUp("[MBR_Last_Name]", "Mbr_Tbl", "[MBR_Bond_Nbr]='" & [txtBndNbr] & "'")

    You can use it in the ControlSource or in VBA code as in my suggestion.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    ballj_35 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2010
    Location
    Columbus Oh
    Posts
    25
    June7,

    I have it coded like you have stated and I am still getitng an error. Coded as follows in the Control SOurce:

    =DLookUp("[MBR_Last_Name]","Mbr_Tbl","[ MBR_Bond_Number]= " & [Form]![txtBndNbr] & "")

    When I switch to Form View to test, in the Find Bnd Nbr field, it has "#Type!". The MBR_Bond_Number is Data Type: Number, Field Size: Double. The field txtBndNbr has a Format of General Number. DO not see what I am doing wrong here. I am confused.

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,740
    If you look carefully at June7's code, you'll see single quotes enclose the Form!txtBndNbr

    '" & [txtBndNbr] & "'") change your code to match June7's post

  8. #8
    ballj_35 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2010
    Location
    Columbus Oh
    Posts
    25
    I thank everying so much for the assistance. This is great to have a forum to reach out to others with the knowledge to help get through these challenges!

    Jerry

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

Similar Threads

  1. Replies: 2
    Last Post: 05-11-2012, 11:52 AM
  2. Replies: 1
    Last Post: 11-21-2011, 07:58 AM
  3. Replies: 5
    Last Post: 03-03-2011, 03:56 PM
  4. Replies: 9
    Last Post: 02-15-2011, 03:05 PM
  5. Find Next Button on Form
    By CindyIvey in forum Access
    Replies: 3
    Last Post: 02-10-2011, 03:09 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
  •  
Other Forums: Microsoft Office Forums