incagold
Programmer
- Mar 21, 2003
- 54
Hi All,
Newbie back with another problem. This is rather urgent, so any help would be greatly appreciated.
The problem is we have a form with a command button that when clicked will search a table to see if a record exists, if not it displays additional text boxes for input. We tried using a function that we have used frequently in ACC2000 but now gives us an error using XP. The error is:
The Microsoft Jet database engine does not recognize 'jones' as a valid field name or expression.
This is the code:
Private Sub cmdSubmit_Click()
On Error GoTo Err_cmdSubmit_Click
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strCriteria As String
Dim strSender As String
strSender = Me.txtLName.Value
strCriteria = "[Last_Name] =" & strSender
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("tblSENDER", dbOpenDynaset)
'*** Search table for Sender
rst.FindNext strCriteria
'*** If not present ask Sender to input data
If rst.NoMatch Then
Dim Msg, Style, Title, Response
Msg = "Your Name Is Not Currently On File "
Msg = Msg & vbCr & vbCr & "Please Complete The Information Below."
Style = vbOKOnly + vbExclamation
Title = "SENDER NAME NOT ON RECORD"
Response = MsgBox(Msg, Style, Title)
Me.lblFirst.Visible = True
Me.txtFName.Visible = True
Me.lblTle.Visible = True
Me.txtTitle.Visible = True
Me.lblExn.Visible = True
Me.txtExt.Visible = True
Me.txtLName.SetFocus
Me.txtLName.Value = ""
End If
rst.Close
Set dbs = Nothing
DoCmd.Close
Exit_cmdSubmit_Click:
Exit Sub
Err_cmdSubmit_Click:
MsgBox Err.Description
Resume Exit_cmdSubmit_Click
End Sub
We have tried everything that we know with our limited knowledge. The routine has worked in ACC2000 without incident. What have we missed? Again, any help would be appreciated. Thanks in advance.
EAF
Newbie back with another problem. This is rather urgent, so any help would be greatly appreciated.
The problem is we have a form with a command button that when clicked will search a table to see if a record exists, if not it displays additional text boxes for input. We tried using a function that we have used frequently in ACC2000 but now gives us an error using XP. The error is:
The Microsoft Jet database engine does not recognize 'jones' as a valid field name or expression.
This is the code:
Private Sub cmdSubmit_Click()
On Error GoTo Err_cmdSubmit_Click
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strCriteria As String
Dim strSender As String
strSender = Me.txtLName.Value
strCriteria = "[Last_Name] =" & strSender
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("tblSENDER", dbOpenDynaset)
'*** Search table for Sender
rst.FindNext strCriteria
'*** If not present ask Sender to input data
If rst.NoMatch Then
Dim Msg, Style, Title, Response
Msg = "Your Name Is Not Currently On File "
Msg = Msg & vbCr & vbCr & "Please Complete The Information Below."
Style = vbOKOnly + vbExclamation
Title = "SENDER NAME NOT ON RECORD"
Response = MsgBox(Msg, Style, Title)
Me.lblFirst.Visible = True
Me.txtFName.Visible = True
Me.lblTle.Visible = True
Me.txtTitle.Visible = True
Me.lblExn.Visible = True
Me.txtExt.Visible = True
Me.txtLName.SetFocus
Me.txtLName.Value = ""
End If
rst.Close
Set dbs = Nothing
DoCmd.Close
Exit_cmdSubmit_Click:
Exit Sub
Err_cmdSubmit_Click:
MsgBox Err.Description
Resume Exit_cmdSubmit_Click
End Sub
We have tried everything that we know with our limited knowledge. The routine has worked in ACC2000 without incident. What have we missed? Again, any help would be appreciated. Thanks in advance.
EAF