Results 1 to 3 of 3

Thread: Help With SQL

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 1999
    Posts
    40

    Post

    'look this over carefully...I changed some things and names
    'some intentional and some not...had to recreate it to
    'make sure it worked....adjust the names and things to
    'your application
    .
    .this works...tried...tested...& true....(VB6)
    '
    '
    Dim strSQL As String
    Dim strPartNumber As String
    Dim filepart As String

    strPartNumber = txtpartnumber.Text

    strSQL = "SELECT * FROM RptPart WHERE PartNumber = '" & strPartNumber & "'"
    Data1.RecordSource = strSQL
    Data1.Refresh

    With Data1.Recordset
    While Not .EOF

    filepart = Data1.Recordset!PartNumber
    List1.AddItem filepart

    .MoveNext
    Wend

    End With


    [This message has been edited by Juillet (edited 07-31-1999).]

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Posts
    118

    Post

    Hi I am trying to use SQL to find a record in a MSAccess databse. I can't seem to get it to work . Here is my code. Thanks in Advance.
    Private Sub Command1_Click()
    Dim strSQL As String
    Dim strPartNumber
    With Me.Data1
    strSQL = "SELECT * FROM Rtppart" & _
    "WHERE (PartNumber = ""& txtPartNumber & "");"
    Data1.RecordSource = strSQL
    Data1.Refresh
    End With
    End Sub

  3. #3
    New Member
    Join Date
    Nov 1999
    Location
    millersport, Ohio USA
    Posts
    8

    Post

    I use a lot of DAO and some Data controls try this:
    "SELECT [fields you want to retrive] FROM [your table] WHERE [your field] = """ & txtwhatever.Text & """"
    The [] must be used if there is a space in the string, all SQL must be in all upercase, the(")quotation marks are critical!!Be sure to use the right number of them at the right places or it will not work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width