Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime 3464

Status
Not open for further replies.

LonC25

IS-IT--Management
Nov 19, 2002
62
0
0
US
I am getting a runtime error when I try to refresh my datasource. I am connecting to a simple Access database and trying to select all customers with a certain ID. It does that fine but it gives me a runtime error on the data refresh. can anyone help...

Private Sub cmdSubmit_Click()
Dim pstrSQL As String

If txtUserEnteredID.Text <> &quot;&quot; Then
pstrSQL = &quot;SELECT * From tblCustomer &quot; & _
&quot; Where fldCustomerID = &quot; & txtUserEnteredID.Text


datMentor.RecordSource = pstrSQL
datMentor.Refresh
datMentor.Visible = True
End If
End Sub
 
3464 is a data type mismatch error. I suspect the problem is that although txtUserEnteredID.Text is a string, the Where clause doesn't enclose it in apostrophes and hence the expected data type of the id field is numeric. If id is a text field then try:

pstrSQL = &quot;SELECT * From tblCustomer &quot; & _
&quot; Where fldCustomerID = '&quot; & txtUserEnteredID.Text & &quot;'&quot;


Paul Bent
Northwind IT Systems
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top