Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Belfast, UK

    Unanswered: Searchform problems.


    I have four forms,

    form1 = main data entry form
    form2 = multiple criteria search form
    form3 = search results
    form4 = subform for searchresult in datasheet mode (running from query).

    So far I can get the search form running and displaying the result in the subform without any problem, however what I want to be able to do is when a user selects a row on the subform the value in one of the selected columns will populate in a textbox on the search result form. when the user click ok on the search result form it will open the selected record on the main data entry form for editting.

  2. #2
    Join Date
    Dec 2002
    Préverenges, Switzerland
    where is your difficulty:

    referring to one form from another?
    in form2
    forms!form3.anytextboxonform3 = anytextboxonform2

    setting a recordsource?
    in form2
    dim strSQL as string
    strSQL = "SELECT * FROM yourTable "
    'if numeric
    strSQL = strSQL & "WHERE aField = " & anytextboxonform2 & ";"
    'if text
    strSQL = strSQL & "WHERE aField = '" & anytextboxonform2 & "';"
    forms!form3.recordsource = strSQL

    or ???

    currently using SS 2008R2

  3. #3
    Join Date
    Dec 2003
    Belfast, UK
    ok, I've fixed form/subform problem but what i can't seem to do is to get the select record from the search to be populated in form1.

    here's the code I'm using.

    Private Sub CmdOK_Click()
    On Error GoTo Err_cmdok_Click

    caseid = Me.txtCaseID
    DoCmd.OpenForm "frmcase", acNormal, , , acFormEdit, acWindowNormal, caseid

    Exit Sub

    MsgBox Err.Description
    Resume Exit_cmdok_Click

    End Sub

    although I have also tried

    DoCmd.OpenForm "frmcase", acNormal, , "where intcase = "&caseid&";", acFormEdit, acWindowNormal

    and it still didn't work.


Posting Permissions

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