Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Location
    California
    Posts
    6

    Unanswered: searching records

    I am trying to use a form to search a table by entering text in a text box and then clicking a command button. My table will have account# and account name. User will be able to enter the account# in the text box and click on the command button. The command button will search the table and see if what input matches what's on the table. I have created some codes below, I tried it and it seems to work.. Is the codes correct tho??


    However, I want to be able to open up another form called frmLogoff if what the user input matches with the table.


    Thanks in advance for the assistance!


    Private Sub cmdSearch_Click()

    Dim rs As DAO.Recordset

    'set recordset
    Set rs = Me.RecordsetClone
    rs.FindFirst "ACCT = """ & Me.txtAccount & """"

    'Check to see if match is found
    If rs.NoMatch Then
    MsgBox "Sorry, No Account found"
    txtAccount.Text = ""
    Else
    'if match, show frmLogoffs.. what should I do here

    End If
    Set rs = Nothing


    End Sub

  2. #2
    Join Date
    Jan 2003
    Location
    Vietnam
    Posts
    188

    docmd.openform "frmLogoffs"

    Originally posted by mummmy
    Private Sub cmdSearch_Click()

    If rs.NoMatch Then
    MsgBox "Sorry, No Account found"
    txtAccount.Text = ""
    Else
    'if match, show frmLogoffs.. what should I do here

    End If
    Set rs = Nothing


    End Sub
    hope this helps
    qha_vn

  3. #3
    Join Date
    May 2003
    Location
    Dallas
    Posts
    817
    Provided Answers: 5
    if match
    docmd.openform, "formname"


    set thecriteria of the recordsource behind the logoffform so that the userid or account number matches the id of the firstform

    I hope I understood correctly -

    let me know

  4. #4
    Join Date
    May 2003
    Location
    California
    Posts
    6
    Hi, the docmd.openform works... Thank you.

    However, how do I set the criteria of the record source behind the logoffform??

    Please help. Thanks.



    Originally posted by axsprog
    if match
    docmd.openform, "formname"


    set thecriteria of the recordsource behind the logoffform so that the userid or account number matches the id of the firstform

    I hope I understood correctly -

    let me know

Posting Permissions

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