Can't Set RecordSet, Object Required

sambo

Registered User.
Local time
Today, 05:04
Joined
Aug 29, 2002
Messages
289
What is wrong with this Sub Procedure?

Private Sub Form_Open(Cancel As Integer)
Dim whichSet As String
whichSet = "SELECT tblHistory.Comment, tblRma.SerialNum, tblRma.RmaID " & _
"FROM tblRma INNER JOIN tblHistory ON tblRma.RmaID = tblHistory.RmaID " & _
"WHERE (tblRma.SerialNum)=" & commentOpener.finalSerial '![Comment Form]![serialHolder]))"


Set Me.Recordset = whichSet

Call fillRecords(Me.Recordset, Me.SerialHolder)

End Sub

I am trying to resest the Recordset Dynamically upon entry to the form.

[commentOpener.finalSerial] is a global variable that I get from the function that calls the Form to Open.
I get the error "Object Required". Probably syntax w/ my Recordset statement.
 
This is how I work with recordsets

Dim rstMyRecordset as Recordset
Dim dbsMyDatabase as Database
Dim whichSet As String

whichSet = "SELECT tblHistory.Comment, tblRma.SerialNum, tblRma.RmaID " & _
"FROM tblRma INNER JOIN tblHistory ON tblRma.RmaID = tblHistory.RmaID " & _
"WHERE (tblRma.SerialNum)=" & commentOpener.finalSerial '![Comment Form]![serialHolder]))"

Set dbsMyDatabase = CurrentDB
Set rstMyRecordset = dbsMyDatabase.OpenRecordset (whichSet)

Call fillRecords(rstMyRecordset, Me.SerialHolder)

End Sub

I don't know what you are doing inside of fillRecords, but I think I have plugged in some adjustments into your code that will get it to run (or at least a step closer).

Good Luck
 
Thanks Glynch,
Your post helped me.
I also realized that I needed to also change my Record Source (not just my Record Set) for what I was doing.
I got it working now.
 

Users who are viewing this thread

Back
Top Bottom