Trying to grab the contract date out of 1 table and then use it in part of another string for a different table. I keep getting errors though on both when i run it. "data type mismatch in criteria expression" and a few others when i mess around. Can you please tell me what im doing wrong? Thanks!
I messed with it changing and adding removing thigns and i cant get it to work i made sure info IS in my tables nothing is missing its just pulling #'s and nothing is working. Any help would be much appreciated!! Thanks!
Running in circles is what I do best!
Code:
'On Error GoTo flxContracts_Click_Error
Dim ContID As Long
Dim CompID As Long
Dim mCn As ADODB.Connection
Dim Rs As ADODB.Recordset
Dim nRs As ADODB.Recordset
Dim sSql As String
Dim nSql As String
Dim strNote As String
Set mCn = New ADODB.Connection
mCn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\clients.mdb"
CompID = flxContracts.Text
Set nRs = New ADODB.Recordset
nSql = "SELECT ContractID FROM Contracts WHERE CustomerID = " & txtAcctID & " AND ComputerID = " & CompID [b]nRs.Open nSql, mCn, adOpenForwardOnly, adLockOptimistic[/b] [COLOR=green]'this errors out[/color]
While Not nRs.EOF
ContID = GetString(nRs.Fields("ContractID"))
Wend
nRs.Close
'(flxSearch.MouseRow)
sSql = "SELECT NoteDate, Notes FROM Notes WHERE CustomerID = " & txtAcctID & " AND ContractID = " & ContID & " AND CategoryID = 002"
Set Rs = New ADODB.Recordset
[b]Rs.Open sSql, mCn, adOpenKeyset, adLockOptimistic, adCmdTable[/b] [COLOR=green]'this errors out[/color]
Rs.MoveFirst
While Not Rs.EOF
strNote = Format(GetString(Rs.Fields("NoteDate").Value), "mm/dd/yy") & ": " & GetString(Rs.Fields("Notes").Value) & "\n" & strNote
Rs.MoveNext
Wend
lstVisits = strNote
Rs.Close
mCn.Close
' On Error GoTo 0
' Exit Sub
'flxContracts_Click_Error:
' MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure flxContracts_Click of Form frmCLient"
I messed with it changing and adding removing thigns and i cant get it to work i made sure info IS in my tables nothing is missing its just pulling #'s and nothing is working. Any help would be much appreciated!! Thanks!
Running in circles is what I do best!