Starting to work with MS Access Project and trying to convert an existing database to Access Project.
The old database was based on DAO references, now I am converting to ADO
However I am having a problem with a DCount code that works perfectly in the Normal Access database, but not in Project with the SQL2000 backend
If I run the sub described below I keep getting the error message
Runtime error 170
Line1: incorrect syntax near '#'
the debug points to the first Dcount line
I tried a number of different formats etc but none seems to work.
Any ideas what is going on here?
Private Sub Schedule_Click()
Dim strInput As Date
Dim strMsg As String
Dim test As Date
Dim testdate As Date
Dim testdate2 As Date
Beep
strMsg = "To avoid incorrect sequencing of the planning schedule please enter the first date of the month that you want to add to the schedule." & vbCrLf & vbLf & "Please enter the daye as follows DD/MM/YY."
strInput = InputBox(Prompt:=strMsg, Title:="Add new budgeted slots to the planner")
If DCount("slotdate", "TblSlotFrame1", "slotdate = #" & Format(strInput, "mm\/dd\/yyyy") & "#") > 0 Then
Displaymessage "The slots for this period starting '" & strInput & "' have already been created. Please check your entry."
Exit Sub
Else
If DCount("slotdate", "TblSlotFrame1", "slotdate = #" & Format(strInput, "mm\/dd\/yyyy") & "# - 1") > 0 Then
createnewslotdates
Else
Displaymessage "The system cannot find an entry for the previous period before '" & strInput & "'." & vbCrLf & vbCrLf & "Please select the previous month on the budget page and create the slots for that period first."
End If
End If
End Sub
The old database was based on DAO references, now I am converting to ADO
However I am having a problem with a DCount code that works perfectly in the Normal Access database, but not in Project with the SQL2000 backend
If I run the sub described below I keep getting the error message
Runtime error 170
Line1: incorrect syntax near '#'
the debug points to the first Dcount line
I tried a number of different formats etc but none seems to work.
Any ideas what is going on here?
Private Sub Schedule_Click()
Dim strInput As Date
Dim strMsg As String
Dim test As Date
Dim testdate As Date
Dim testdate2 As Date
Beep
strMsg = "To avoid incorrect sequencing of the planning schedule please enter the first date of the month that you want to add to the schedule." & vbCrLf & vbLf & "Please enter the daye as follows DD/MM/YY."
strInput = InputBox(Prompt:=strMsg, Title:="Add new budgeted slots to the planner")
If DCount("slotdate", "TblSlotFrame1", "slotdate = #" & Format(strInput, "mm\/dd\/yyyy") & "#") > 0 Then
Displaymessage "The slots for this period starting '" & strInput & "' have already been created. Please check your entry."
Exit Sub
Else
If DCount("slotdate", "TblSlotFrame1", "slotdate = #" & Format(strInput, "mm\/dd\/yyyy") & "# - 1") > 0 Then
createnewslotdates
Else
Displaymessage "The system cannot find an entry for the previous period before '" & strInput & "'." & vbCrLf & vbCrLf & "Please select the previous month on the budget page and create the slots for that period first."
End If
End If
End Sub