Results 1 to 4 of 4

Thread: access database /VB6

  1. #1
    Join Date
    Jul 2010
    Posts
    5

    access database /VB6

    I am using the following code to search a table for company name and notify the client if there is no Campany name, so he can enter the company name. but I keep getting an error message. Invalid statement, expected delete insert, procedure of update. This line of code gets highlighted

    rs.Open "StrSQL", ad, adOpenDynamic, adLockOptimistic, adCmdText

    HERE ARE MY CODE:
    StrSQL = "select T.CompanyName from TripLogTbl" & _
    "where T.CampanyName IS NOT NULL"
    rs.Open "StrSQL", ad, adOpenDynamic, adLockOptimistic, adCmdText
    If Not rs.BOF And Not rs.EOF Then
    txtCompanyName.Text = rs.Fields("CompanyName").Value
    End If

  2. #2
    Join Date
    Mar 2006
    Location
    Oklahoma City, OK
    Posts
    184
    Quote Originally Posted by alobi View Post
    I am using the following code to search a table for company name and notify the client if there is no Campany name, so he can enter the company name. but I keep getting an error message. Invalid statement, expected delete insert, procedure of update. This line of code gets highlighted

    rs.Open "StrSQL", ad, adOpenDynamic, adLockOptimistic, adCmdText

    HERE ARE MY CODE:
    StrSQL = "select T.CompanyName from TripLogTbl" & _
    "where T.CampanyName IS NOT NULL"
    rs.Open "StrSQL", ad, adOpenDynamic, adLockOptimistic, adCmdText
    If Not rs.BOF And Not rs.EOF Then
    txtCompanyName.Text = rs.Fields("CompanyName").Value
    End If
    Try this:

    Code:
    rs.Open StrSQL, ad, adOpenDynamic, adLockOptimistic, adCmdText
    Boyd Trimmell aka HiTech Coach
    Microsoft MVP - Access Expert
    [SIGPIC][/SIGPIC]
    Office Programming 25+ years as a Software Developer specializing in:
    Business Process Management
    Accounting/Inventory Control
    Customer Relations Management (CRM)
    Electronic Data Interchange (EDI)

  3. #3
    Join Date
    Jul 2010
    Posts
    5
    Thanks HiTechCoach, the change took care of my problem. Problem resolved.

  4. #4
    Join Date
    Mar 2006
    Location
    Oklahoma City, OK
    Posts
    184
    Quote Originally Posted by alobi View Post
    Thanks HiTechCoach, the change took care of my problem. Problem resolved.
    You're welcome!

    Glad I could assist.
    Boyd Trimmell aka HiTech Coach
    Microsoft MVP - Access Expert
    [SIGPIC][/SIGPIC]
    Office Programming 25+ years as a Software Developer specializing in:
    Business Process Management
    Accounting/Inventory Control
    Customer Relations Management (CRM)
    Electronic Data Interchange (EDI)

Posting Permissions

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