Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2003
    Posts
    42

    Unanswered: need help big time!

    Hi,

    I am totally stuck with something...I have created a table called Customers and then I have created a table called Bookings. On the Customer form, the CustomerID, Title, First Name and Surname are all displayed. Then, on the Customer form, you can click a button to Add a Booking for that Customer. This takes you to the Booking form and then on this form, the CustomerID, Title, First Name and Surname are all automatically transferred onto the Bookings form. The code is as follows for the Add a Booking button on the Customer form...

    Private Sub cmdAddBooking_Click() 'Adds a new Booking record to the database
    On Error GoTo Err_cmdAddBooking_Click

    Dim stDocName As String
    Dim stLinkCriteria As String
    stLinkCriteria = "[Customers.CustomerID]= " & Me![txtCustomerID]
    stDocName = "Bookings"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    lblTest.Caption = stLinkCriteria

    Exit_cmdAddBooking_Click:
    Exit Sub

    Err_cmdAddBooking_Click:
    MsgBox Err.Description
    Resume Exit_cmdAddBooking_Click
    End Sub

    The record source for the Bookings form is Customer. However, I then need to add another two text boxes to the Bookings form, but these come from a DIFFERENT table, called Theme Days. Obviously, as the record source for the form is the Customer table, I can't select the two required fields from the Theme Days table! Please help!!!!! I am desperate!

  2. #2
    Join Date
    Dec 2003
    Posts
    42
    im really stuck any ideas people? thank you

  3. #3
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    InNeedOfHelp Hi,

    The record source for the Bookings form is Customer. However, I then need to add another two text boxes to the Bookings form, but these come from a DIFFERENT table, called Theme Days. Obviously, as the record source for the form is the Customer table, I can't select the two required fields from the Theme Days table! Please help!!!!! I am desperate!
    Create a query that ties Bookings and ThemeDays together with say the BookingID primary key field. Then you can pull your two text boxes (whatever they may be called) into the form..

    Bud

  4. #4
    Join Date
    Dec 2003
    Posts
    42
    How, because if I change the record source to a Query and not as the Customer table on the booking form, it doesn't carry over the customer's details from the Customer form to the Booking form.

  5. #5
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Write a query to pull the data from your other table ... Use either ADO or DAO to do it ...
    Back to Access ... ADO is not the way to go for speed ...

  6. #6
    Join Date
    Dec 2003
    Posts
    42
    I don't have a clue how to do that - help pleaaaaaase!!!

  7. #7
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Quote Originally Posted by InNeedOfHelp
    I don't have a clue how to do that - help pleaaaaaase!!!
    It's simple. Take the query that you have right now in DesignView, Click above to ADD the other table which has a common field (primary key) that links the two tables together. Then include your ForeignKey from the first table you have and then include to corresponding fields from the newly added table. Go to your form and change your record source to that query. Need any further help, please Zip and Attached your database and we can better help you.

    hope this helps....
    gone for the day,
    Bud

  8. #8
    Join Date
    Dec 2003
    Posts
    42
    Hi,

    Please find attached the database. I want the Date of Event field to be a combo box on the Bookings form (taken from the Theme Days table) and then when you click the chosen date of event, the theme that relates to goes into a text box underneath the combo box on the Bookings form. Please find attached the database.

    Thank you very much!!!
    Attached Files Attached Files

Posting Permissions

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