|
-
Jul 9th, 1999, 05:52 PM
#1
Thread Starter
Lively Member
Code:
Private Sub txtHomePhone_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
KeyAscii = 0
Dim strSQL As String
strSQL = "SELECT *From Customer Where (HomePhone = txtHomePhone)"
rsOrderInfo!LastName = txtLastName
txtLastName.SetFocus
End If
End Sub
I am Trying to find the match to a home phone number that the user enters and show the results.I have never used SQL and would be thankful for help
Thanks
Paul
------------------
-
Jul 10th, 1999, 11:47 AM
#2
Junior Member
From looking at your post, I gather that the problem is that your SQL query does not work. When you put a variable in an SQL string, you have to put it inside single quotes, and to do THAT, you have to put the single qoutes inside regular quotes, otherwise VB sees the first single as meaning Remark.
strSQL = "SELECT * From Customer Where HomePhone = " & "'"txtHomePhone"'"
Try that (as a single line). it should work fine.
BTW, just about everyone stumbles over this the first time, so don't feel bad.
Dave
------------------
-
Jul 11th, 1999, 02:26 AM
#3
Hyperactive Member
Paul,
The select clause should be Tablename.Field
Try:
"SELECT Customer.* From Customer Where (HomePhone = txtHomePhone)"
Al.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|