SQL Error .... HELP Please

  • Thread starter Thread starter Arookie VB'er Named Bob
  • Start date Start date
A

Arookie VB'er Named Bob

I have an Access database with a TABLE named ProcessLog

There is a FIELD named InputFileNameWithoutPath

I am opening a text file and writing to the database.
Before I do so I want to make sure I have not already written that file to
the database.
So the filename from the text file variable name is theInputFile

here is the code below that gives an error:

I get this error: Run-time error -2147217904 (80040e10) No value given
for one or more required parameters.

I know it is in the CMD string that is wrong. Can anyone help.

_+_+_+_+_+_+_+_ CODE BELOW +_+_+_+_+_+_+

Dim cnn1 As ADODB.Connection
Dim rstProcessLog As ADODB.Recordset ' Corresponds to Table: ProcessLog
Dim SqlString As String
Dim cmd As String

Set cnn1 = New ADODB.Connection
cnn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " &
DataBasePathAndFileName & ";Persist Security Info=False"
cnn1.ConnectionTimeout = 30
cnn1.Open
' Display the state of the connections.
GetState (cnn1.State)

Set rstProcessLog = New ADODB.Recordset
rstProcessLog.CursorType = adOpenDynamic
rstProcessLog.LockType = adLockBatchOptimistic

cmd = "SELECT * FROM ProcessLog Where rstProcessLog!InputFilenameWithoutpath
_
= FileNameWithExtensionButNoPath"

rstProcessLog.Open cmd, cnn1, , , adCmdText
 
I think this may work:

cmd = "SELECT * FROM ProcessLog Where " & _
rstProcessLog!InputFilenameWithoutpath & _
"='" & FileNameWithExtensionButNoPath & "'"
 
Back
Top