M
Mandy
Hi Guys,
Please I need help to debug the following code, intending
to check in the main form whether there is double entry of
data, but when I try to run it, it says Syntax error...How
to fix it. I am using the MicrosoftR Access 2000(9.0 3B21
SR-1). Thanks a lot.
Dim ID As String
ID = InputBox("Please enter patient's ID number")
If ID = "" Then
Exit Sub
End If
Dim stDocName As String
stDocName = "<Parkinson data entry>"
Dim pat_data As New ADODB.Recordset
pat_data.Open "[data entry]",
(###THIS IS SHADED, and Syntax error appeared here###)
CurrentProject.Connection, adOpenStatic
pat_data.Find "[ID]='" & ID & "'"
If pat_data.EOF Then
DoCmd.OpenForm stDocName
DoCmd.GoToRecord , , acNewRec
Forms![<data entry>]![ID] = ID
Forms![<data entry>].Dirty = False
Else
Dim create_new As Integer
create_new = MsgBox("A person with the ID you entered
already
exists
in the database. Would you like to edit this entry?",
vbYesNo +
vbQuestion, "Patient record already exists")
If (create_new = 6) Then
Dim stLinkCriteria As String
stLinkCriteria = "[ID]='" & ID &
"'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End If
HELP!!!! PLEASE!!!!! MANY THANKS!!!!!!!!! Mandy
Please I need help to debug the following code, intending
to check in the main form whether there is double entry of
data, but when I try to run it, it says Syntax error...How
to fix it. I am using the MicrosoftR Access 2000(9.0 3B21
SR-1). Thanks a lot.
Dim ID As String
ID = InputBox("Please enter patient's ID number")
If ID = "" Then
Exit Sub
End If
Dim stDocName As String
stDocName = "<Parkinson data entry>"
Dim pat_data As New ADODB.Recordset
pat_data.Open "[data entry]",
(###THIS IS SHADED, and Syntax error appeared here###)
CurrentProject.Connection, adOpenStatic
pat_data.Find "[ID]='" & ID & "'"
If pat_data.EOF Then
DoCmd.OpenForm stDocName
DoCmd.GoToRecord , , acNewRec
Forms![<data entry>]![ID] = ID
Forms![<data entry>].Dirty = False
Else
Dim create_new As Integer
create_new = MsgBox("A person with the ID you entered
already
exists
in the database. Would you like to edit this entry?",
vbYesNo +
vbQuestion, "Patient record already exists")
If (create_new = 6) Then
Dim stLinkCriteria As String
stLinkCriteria = "[ID]='" & ID &
"'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End If
HELP!!!! PLEASE!!!!! MANY THANKS!!!!!!!!! Mandy