I just want to create a recordset (Runtime Error 424)

Arhat

New member
Local time
Today, 14:44
Joined
Jul 20, 2007
Messages
4
Why does the following code generate an error. All i want to do is open a recordset which I thought would be straightforward. (novice Programmer, new to access vba). The set statement in the ComboProduct event generates the error.

Option Compare Database
Dim Company As String
Private dbaProposal As DAO.Database
Dim EffectiveDate As Date
Dim Product As String
Private rstProposal As DAO.Recordset

Private Sub ComboProduct_AfterUpdate()
Product = ComboProduct.Value
Set rstProposal = dbsProposal.OpenRecordset("SELECT * FROM Proposals WHERE Proposals.[Group Name]='" & Company & "' AND Proposals.[Effective Date]=#" & EffectiveDate & "# AND Proposals.Product='" & Product & "'")
End Sub

Private Sub Form_Load()
Set dbsProposal = DBEngine.OpenDatabase("Database1.accdb")
End Sub
 
Variable Name misspelled

dbaProposal does not match dbsProposal
 
If you start your class module with:
Code:
Option Compare Database
[b]Option Explicit[/b]
...you will catch those typo errors.
 

Users who are viewing this thread

Back
Top Bottom