ItIsHardToProgram
Technical User
I am using a code that works on one of my form in another form.
1) I have changed variables
2) I made sure there is no conflict
3) There are no empty vars, and even if there were it should not do errors.
Here is the code I use with the highlight part were it messes up
SelSemDep is a combobox that contains Date values.
StartDate is = to 2006-01-29, for example.
Date1 is the field name in the table Dépense.
The code gives me the following error: Error 13, incompatibity between the 2 statements.
The problem I am having is that strWhere is a string, and I do not understand why a string could have incompatibility between 2 statements that are obviously strings..... it is not overflown or anything...
Even more troubling, that statements is used at alot of places in my database and works fine...
Please enlighten me... any suggestion will probably help, and an explanation would be the greatest, thank you.
"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
1) I have changed variables
2) I made sure there is no conflict
3) There are no empty vars, and even if there were it should not do errors.
Here is the code I use with the highlight part were it messes up
Code:
Private Sub SelSemDep_AfterUpdate()
' Rechercher l'enregistrement correspondant au contrôle.
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strWhereDep As String
TestWhileDep = False
startdate = Me.SelSemDep.Column(1)
enddate = Me.SelSemDep.Column(2)
Set db = CurrentDb()
Set rs = db.OpenRecordset("Dépense", dbOpenDynaset)
[highlight]strWhereDep = "[Date1] = " & "#" & Str(Nz(startdate)) & "#"[/highlight]
rs.FindFirst strWhereDep
If rs.NoMatch Then
TestWhileDep = True
End If
If TestWhileDep = True Then
AddNewRecord
'rs![date1] = Str(Nz(startdate))
'rs![date2] = Str(Nz(enddate))
'rs![Nom] = Y
'rs![PreN] = z
'rs![no_emp] = EmpNumber()
'rs.Update
End If
Me.Bookmark = rs.Bookmark
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
If TestWhileDep = False Then
Set db = CurrentDb()
Set rs = db.OpenRecordset("Dépense", dbOpenDynaset)
strWhereDep = "[Date1] = " & "#" & Str(Nz(startdate)) & "#"
rs.FindFirst strWhereDep
Me.Bookmark = rs.Bookmark
End If
End Sub
SelSemDep is a combobox that contains Date values.
StartDate is = to 2006-01-29, for example.
Date1 is the field name in the table Dépense.
The code gives me the following error: Error 13, incompatibity between the 2 statements.
The problem I am having is that strWhere is a string, and I do not understand why a string could have incompatibility between 2 statements that are obviously strings..... it is not overflown or anything...
Even more troubling, that statements is used at alot of places in my database and works fine...
Please enlighten me... any suggestion will probably help, and an explanation would be the greatest, thank you.
"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.