snicker
Registered User.
- Local time
- Today, 05:54
- Joined
- Aug 8, 2003
- Messages
- 91
All I want to do is pop up a message box that warns a user if a recordset has more than 1 record in it. here is the query I am using:
SELECT Count(TrustPinNumbers.PinNumber) AS CountOfPinNumber, First(TrustPinNumbers.ClientNum) AS FirstOfClientNum FROM TrustPinNumbers HAVING (((First(TrustPinNumbers. ClientNum))=[Forms]![BCBTaxPayments]![txtClientNum2]));
This is one of the many Subs I have tried:
Code
_________________________________________
Private Sub cboClientName2_AfterUpdate()
Dim db As Database
Dim qrd As QueryDef
Dim rst As Recordset
Set db = DBEngine(0)(0)
Set qrd = db.QueryDefs("QryPinCount")
qrd.Parameters("ClientNum") = Me.Controls("cboClientName2")
Set rst = qrd.OpenRecordset(dbOpenDynaset)
MsgBox "worked"
Set rst = Nothing
Set qrd = Nothing
Set db = Nothing
__________________________________________
Outcome
Run-time error '3265'
Item not found in this collection.
There is something I am missing. All I really want to do is fiqure out how to open a query as a recordset..... right? Any help would be greatly appreciated.
thx in advance Mike
Access 2002 Developer Edition
SELECT Count(TrustPinNumbers.PinNumber) AS CountOfPinNumber, First(TrustPinNumbers.ClientNum) AS FirstOfClientNum FROM TrustPinNumbers HAVING (((First(TrustPinNumbers. ClientNum))=[Forms]![BCBTaxPayments]![txtClientNum2]));
This is one of the many Subs I have tried:
Code
_________________________________________
Private Sub cboClientName2_AfterUpdate()
Dim db As Database
Dim qrd As QueryDef
Dim rst As Recordset
Set db = DBEngine(0)(0)
Set qrd = db.QueryDefs("QryPinCount")
qrd.Parameters("ClientNum") = Me.Controls("cboClientName2")
Set rst = qrd.OpenRecordset(dbOpenDynaset)
MsgBox "worked"
Set rst = Nothing
Set qrd = Nothing
Set db = Nothing
__________________________________________
Outcome
Run-time error '3265'
Item not found in this collection.
There is something I am missing. All I really want to do is fiqure out how to open a query as a recordset..... right? Any help would be greatly appreciated.
thx in advance Mike
Access 2002 Developer Edition