Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Feb 2002
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Rowsource (A2000)

    I have a form "frmLabourBooking" which has a subform "sbfLabourBooking" and two unbound text's [txtSearchEstimateNo],[txtSearchSupp]
    The table behind the form is "tblLabourBooking"

    The form opens with txtSearchEstimateNo having the first focus, (the user enters an [EstimateNo]) then txtSearchSupp gets the next focus, (the user enters a [Supp] Number.

    I've done this before but can't for the life of me remember how.

    I want the subform filled with these two records.

    Summary:

    Form opens
    User enters an EstimateNo & Supp
    After Supp is filled, the after update event fills the subform.


    Dave

    Zip File Attached
    Attached Files Attached Files

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rowsource (A2000)

    Use this code in the after update of txtSearchSupp :
    <pre>Private Sub txtSearchSupp_AfterUpdate()
    Dim strSQL As String
    strSQL = "SELECT tblLabourBooking.Date, tblLabourBooking.EstimateNo, " & _
    "tblLabourBooking.Supp, tblLabourBooking.Name, tblLabourBooking.Operation, " & _
    "tblLabourBooking.TG, tblLabourBooking.TT " & _
    "FROM tblLabourBooking"
    'If the textboxes are empty, show all records.
    If Not IsNull(Me.txtSearchEstimateNo) And Not IsNull(Me.txtSearchSupp) Then
    strSQL = strSQL & " WHERE EstimateNo = " & Me.txtSearchEstimateNo & _
    " AND Supp = " & Me.txtSearchSupp
    End If
    Me.sbfLabourBooking.Form.RecordSource = strSQL
    Me.sbfLabourBooking.Requery
    End Sub</pre>

    Of course you should add some on error code.
    Francois

  3. #3
    Star Lounger
    Join Date
    Feb 2002
    Posts
    56
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rowsource (A2000)

    Thanks once again Francois

    Dave

  4. #4
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rowsource (A2000)

    Just an observation:

    Having a field named

Posting Permissions

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