Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    18

    Unanswered: Im stuck with a listbox and query - Help needed!

    I am creating a video rental database.

    On my main form I can select a certain user from a row on a listbox which loads a second form.

    The second form also has a listbox (lstuserbookings) which displays all the particular bookings of videos that that user has made. It shows videoID, datebookedout, dateduetreturn, userID etc. When I select a row I have textboxes which show the records which relate to the fields.

    On this second form I want to enter a "date video returned" date into a textbox - and have it saved to the bookings table and thus show up in the row on the listbox under the heading "Date Returned". I have the empty field in the corresponding table (tblbookings) and in the query (qryuserbookings) for the listbox.

    I dont know what code to make the textbox save the "date video returned".

  2. #2
    Join Date
    Jan 2005
    Posts
    68
    put this code in the text box's after update event

    Private Sub [TextBoxName]_AfterUpdate()
    Dim db As DAO.Database
    Dim rs As DAO.Recordset

    Set db = CurrentDb
    Set rs = db.OpenRecordset("[table name]")

    With rs
    .AddNew
    ![FieldName]=[TextBoxName].value
    .Update
    .Close
    End With
    End Sub

    note:the bracketed names should be replaced with the names from your form and table. don't include the brackets

    hope it helps

Posting Permissions

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