Greets,
Is it possible for me to assign an ADO recordset to a combobox rowsource? I'm trying to populate a combobox ina subform with transactions based on credit card number input.
Here is the code I'm using in an onEnter event of the search submit form:
Dim db As DAO.Database
Set db = CurrentDb
Dim rs As DAO.Recordset
Dim sqlCbTrans As String
sqlCbTrans = "SELECT [tbl_Transactions].[trns_date], [tbl_Transactions].[trns_amount], [tbl_Transactions].[transactionId], [tbl_Orders].[ord_ccNumber] " & _
"FROM [tbl_Orders] INNER JOIN [tbl_Transactions] ON [tbl_Orders].[orderId] = [tbl_Transactions].[trns_orderId] " & _
"WHERE ([tbl_Orders].[ord_ccNumber]) LIKE '" & Forms![frm_Chargebacks_De]![ccNumber] & "*' "
Set rs = db.OpenRecordset(sqlCbTrans)
If (rs.EOF) Then
MsgBox ("No records found"
Else
Forms!frm_Chargebacks_De!frm_Chargebacks_Transactions_Sub.Form.cbTrns_transactionId.RowSource = rs
End If
Instead of populating the combobox I'm getting a type mismatch error. Am I doing this incorrectly or is this a problem with something else?
Many thanks!
Is it possible for me to assign an ADO recordset to a combobox rowsource? I'm trying to populate a combobox ina subform with transactions based on credit card number input.
Here is the code I'm using in an onEnter event of the search submit form:
Dim db As DAO.Database
Set db = CurrentDb
Dim rs As DAO.Recordset
Dim sqlCbTrans As String
sqlCbTrans = "SELECT [tbl_Transactions].[trns_date], [tbl_Transactions].[trns_amount], [tbl_Transactions].[transactionId], [tbl_Orders].[ord_ccNumber] " & _
"FROM [tbl_Orders] INNER JOIN [tbl_Transactions] ON [tbl_Orders].[orderId] = [tbl_Transactions].[trns_orderId] " & _
"WHERE ([tbl_Orders].[ord_ccNumber]) LIKE '" & Forms![frm_Chargebacks_De]![ccNumber] & "*' "
Set rs = db.OpenRecordset(sqlCbTrans)
If (rs.EOF) Then
MsgBox ("No records found"
Else
Forms!frm_Chargebacks_De!frm_Chargebacks_Transactions_Sub.Form.cbTrns_transactionId.RowSource = rs
End If
Instead of populating the combobox I'm getting a type mismatch error. Am I doing this incorrectly or is this a problem with something else?
Many thanks!