I'm trying to create a function that will search an Access Database to see if a record already exists or not.
I am having problems with my select statement with regards to the where part of it.
Here's what i have so far:
VB Code:
Option Explicit Private prvCNNBatchHeader As New ADODB.Connection Private Function FindExistingRecord(strTransactionType As String, strBatchNumber As String) As Boolean Dim rsBatchHeader As New ADODB.Recordset rsBatchHeader.Open "Select * From BatchHeader Where BatchHeader.TransactionType = strTransactionType and BatchHeader.BatchNumber = strBatchNumber", prvCNNBatchHeader, adOpenDynamic, adLockOptimistic end Function
I am getting an error stating: [Microsoft][ODBC Microsoft Access Driver] Too Few Parameters. Expected 2.
Where i run the select part without the where clause, it seems to work fine, but not with the Where.
Hope someone can help
thanks




Reply With Quote