Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a Recordset based on three parameters

Status
Not open for further replies.

Syerston

Programmer
Jun 2, 2001
142
GB
My wish list would be to create a recordset based on three parameters from three text fields on a form, and populate a combo box (or similar if you know of a better way) with the returned recordset.

I can create the recordset based on the three parameters but I have encountered the following problems.

1. I want the recordset to be returned if less then the three parameters are completed.

2. When I try to populate the combo box at the moment I keep getting the error message

Run Time Error '451'
Property let Procedure not defined and property get procedure did not return an objectOption Compare Database

I have enclosed a cut down version of the code I am currently using (only one parameter)

Dim db As Database, strSearch As String, rstSearch As Recordset
Code:
Private Sub cmdSearch_Click()
Set db = CurrentDb()
    strSearch = "SELECT tblClaimants.Surname FROM tblClaimants WHERE tblClaimants.Surname = '" & Forms!frmSearch!txtSurname & "'"
Set rstSearch = db.OpenRecordset(strSearch)
    Me!cboSearch.Column(0) = rstSearch.Fields(0)
rstSearch.Close
db.Close
End Sub
Many Thanks for any help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top