G
Guest
I am working with the example code written by Dev Ashish from The Access Web
site and I have run into a brick wall.
I am trying to debug the following line:
Set rs = db.OpenRecordset("City (table) Query", dbOpenDynaset)
When I run the test the following error message pops up:
An error occurred. Please try again.
No other information is provided.
The following is the code sequence that I have at this time:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub City_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not an available City Name " & vbCrLf &
vbCrLf
strMsg = strMsg & "Do you want to associate the new Name to the current
DLSAF?"
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to link or No to re-type
it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("City (table) Query", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!CityName = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Any assistance that can be offered will be greatly appreciated.
site and I have run into a brick wall.
I am trying to debug the following line:
Set rs = db.OpenRecordset("City (table) Query", dbOpenDynaset)
When I run the test the following error message pops up:
An error occurred. Please try again.
No other information is provided.
The following is the code sequence that I have at this time:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub City_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String
strMsg = "'" & NewData & "' is not an available City Name " & vbCrLf &
vbCrLf
strMsg = strMsg & "Do you want to associate the new Name to the current
DLSAF?"
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to link or No to re-type
it."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo Then
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("City (table) Query", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!CityName = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Any assistance that can be offered will be greatly appreciated.