Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2004
    Raleigh, NC

    Unanswered: Return search in a subform

    I have an Access db with a main form that contains a tab control. On the second tab, I have a subform which displays classified ads for a particular customer. My question is this:

    How do I go about creating a text box on the main form ("Accounts") that I can type a particular word or words into, and Access with return all records that contain the search criteria in a subform or new pop-up form?

    In other words, if I want to search for "milk", then Access might display a new form with the following two records displayed.

    "Free milk to anyone with a spare container. You must pump and pickup."

    "Milk, it does a body good"

    ...or for a more complex search, I might try "firewood for winter" and Access would return:

    "It's getting cold outside, make sure you get your firewood for winter before it's all gone!"

    I know this is fairly simple, but it has stumped me for 2 days. Any help or advice would be greatly appreciated. Thank you.

  2. #2
    Join Date
    Sep 2004
    Raleigh, NC
    I figured this out partly on my own using the following code, but can anyone tell me how I can search more than one field at the same time? I want to return all results where a certain word appears in either field.

    Private Sub Command344_Click()
    On Error GoTo Err_Command344_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmClassifieds"

    stLinkCriteria = "[ClassifiedHead] LIKE " & "'*" & [Text341] & "*'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Exit Sub

    MsgBox Err.Description
    Resume Exit_Command344_Click
    End Sub

Posting Permissions

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