TeresePamela
Programmer
I'm using Access 2000.
My users enter one of four values via a textbox, the entered value is found in the "many" table and the linking field is stored to a variable I call FoundPNR, The main form displays the data from the "many" side of the one-to-many relationship in a listbox. I want the sub-form to display the data for the related record from the "one" side. I'm trying to do this by setting the subform's recordsource to the value of an SQL Statement. I'v tried so many different ways and receive error messages no matter what. Below is a section of my code. Can anyone tell me where I'm going wrong?
XREF_01 is the "one" side table. XREF_03 is the "many" side table.
strSQL = "SELECT XREF_01.PNR, XREF_01.PEC, XREF_01.PPC, XREF_01.TITLE FROM XREF_01 " & _
" WHERE XREF_01.PNR like '" & FoundPNR & "*';"
Forms![FrmMain]![FrmFamily].RecordSource = strSQL
Forms![FrmMain]![FrmFamily].Visible = True
As always any help will be greatly appreciated,
Thanks
Pam
My users enter one of four values via a textbox, the entered value is found in the "many" table and the linking field is stored to a variable I call FoundPNR, The main form displays the data from the "many" side of the one-to-many relationship in a listbox. I want the sub-form to display the data for the related record from the "one" side. I'm trying to do this by setting the subform's recordsource to the value of an SQL Statement. I'v tried so many different ways and receive error messages no matter what. Below is a section of my code. Can anyone tell me where I'm going wrong?
XREF_01 is the "one" side table. XREF_03 is the "many" side table.
strSQL = "SELECT XREF_01.PNR, XREF_01.PEC, XREF_01.PPC, XREF_01.TITLE FROM XREF_01 " & _
" WHERE XREF_01.PNR like '" & FoundPNR & "*';"
Forms![FrmMain]![FrmFamily].RecordSource = strSQL
Forms![FrmMain]![FrmFamily].Visible = True
As always any help will be greatly appreciated,
Thanks
Pam