Results 1 to 3 of 3
  1. #1
    kristyspdx is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Posts
    23

    Link Multiple Tables to One Form

    Hello,

    I have a form that requires user input. The user inputs a check number in an unbound text box and then the form pulls the data for that check number based off of Table 2. If the check number is not in Table 2, a message is displayed that the record can not be found. Here is the code. Keep in mind I know little about code and stole this from someone else, but it works great.

    Private Sub Enter_Check_Number_AfterUpdate()
    If (Enter_Check_Number & vbNullString) = vbNullString Then Exit Sub
    Dim rs As DAO.Recordset
    Set rs = Me.RecordsetClone
    rs.FindFirst "[Check Number]=""" & Enter_Check_Number & """"
    If rs.NoMatch Then
    MsgBox "Sorry, no such record was found.", _
    vbOKOnly + vbInformation
    Else
    Me.Recordset.Bookmark = rs.Bookmark


    End If
    rs.Close
    txtGoTo = Null
    End Sub

    What I need the form to do now is if the check number entered by the user can not be found in Table 2, to look at Table 3 and then Table 4 to find it. If it is not in Table 2, 3, or 4 it's okay to display the message that the record can't be found. There is no relationship between the three tables, but they all have exactly the same fields. Each record will be in one of the three tables only one time.

    Thanks.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    It is almost certainly a mistake to have 3 tables holding identical fields. If you can't change it, you can do what you're asking. You'd put your code to check table 3 in the "NoMatch" section of the first, and similarly for 4. The other problem you presumably face is that you can't set the bookmark to a record not in the recordset of the form, so you'd have to change the form's source or change forms. Having multiple tables for the same data is going to cause a lot of problems.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,928
    I agree, why are there 3 tables that appear to be identitical in structure?
    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.

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

Similar Threads

  1. Updating Multiple Tables Via One Form
    By JoshuaRogers in forum Forms
    Replies: 2
    Last Post: 03-14-2012, 11:17 AM
  2. How to Display multiple tables in one form
    By saruafra in forum Access
    Replies: 4
    Last Post: 03-06-2011, 07:23 PM
  3. Multiple tables served by one link
    By htchandler in forum Import/Export Data
    Replies: 3
    Last Post: 01-13-2011, 01:49 AM
  4. Multiple tables in 1 form ?
    By baseborn in forum Forms
    Replies: 5
    Last Post: 12-13-2010, 10:06 AM
  5. Update Multiple tables from one form
    By KenK in forum Forms
    Replies: 0
    Last Post: 10-30-2009, 08:44 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