Results 1 to 4 of 4
  1. #1
    Lounger
    Join Date
    Aug 2002
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    wronf number of arguments (Access 2000)

    wrong number of arguments used with query expression run time error 3075

    I want to simplify the following sql:

    stSQL = " SELECT customers.Customerid, customers.CompanyName,customers.afid ,customers.address, " & _
    " customers.employee,customers.city,customers.works, customers.works1,customers.home,customers.mobi," & _
    " customers.taxid,customers.pass,customers.bulstat,c ustomers.kindid,customers.afid

    by making something like that:


    strSQL = " SELECT customers(Customerid,CompanyName,afid ,address,employee,city,works,works1,home,mobi,taxi d,pass,bulstat)

    But then i receive the message wrong number of arguments run time error 3075.
    May i ask for help?

  2. #2
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: wronf number of arguments (Access 2000)

    I don't think you can do that. What you may want to try is an alias for the table name to shorten it Somthing like:

    stSQL = " SELECT c.Customerid, c.CompanyName,c.afid ,c.address, " & _
    " c.employee,c.city,c.works,c.works1,c.home,c.mobi," & _
    " c.taxid,c.pass,c.bulstat,c.kindid,c.afid" & _
    " FROM customers as c"

    Or if you are getting all the the fields from the customers table try:

    stSQL = "SELECT * FROM customers"
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  3. #3
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: wronf number of arguments (Access 2000)

    Bryan is correct - you can't do it with the parenthesis, as Access now thinks you are specifying a function. On the other hand, as long as field names are unique, in Access queries you don't have to use the table name as a prefix as long as the field name is unique. So your statement could simply be:

    <font color=blue>strSQL = "SELECT Customerid, CompanyName, afid , address,employee, city, works, works1, home, mobi, taxid,pass, bulstat FROM Customers;"</font color=blue>
    Wendell

  4. #4
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: wronf number of arguments (Access 2000)

    ... Some other items to check for
    - Don't forget to Dim stSQL as a String
    - Ensure that the table customers has all of the values you are trying to extract
    - the end of your sql statement requires an ;
    - dont forget to indicate FROM in your statement
    Regards,

    Gary
    (It's been a while!)

Posting Permissions

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