Multiple Access tables?

Results 1 to 4 of 4

Thread: Multiple Access tables?

  1. #1
    Gringo Guest

    Default Multiple Access tables?

    I have some trouble with how to select one of many access tables in my database. When I use the following code I get an error.<BR><BR>&#060;%<BR>Set myDB=Server.CreateObject("ADODB.Connection")<BR>my DB.Open "matsedel2"<BR><BR>vvecka=Request.Form("vecka" )& " "<BR>mstyp=Request.Form("msval")& " "<BR><BR>Set Post=myDB.Execute("SELECT * FROM &#039;" & mstyp &"&#039; where vecka=&#039;" & vvecka &"&#039; order by datum")<BR>%&#062;<BR><BR>It seems I can&#039;t write &#039;" & mstyp &"&#039; when I select a table, as I do when I select columns. How can I write this? <BR><BR>mstyp=Request.Form("msval")& " " &#060;----- value from a selection box a bit down, which I thought would represent a table.<BR><BR>Any ideas?

  2. #2
    Alotta Fagina Guest

    Default RE: Multiple Access tables?

    What error are you getting?

  3. #3
    Join Date
    Dec 1969

    Default Drop the apostrophes around the table name

    Apostrophes are only used for selecting strings and dates, not for inserting a string variable. Just drop them. It should look like:<BR><BR>FROM " & mstyp & " WHERE

  4. #4
    Join Date
    Dec 1969

    Default Yup yup....

    If you had done a response.write on the SQL you would have seen that you were trying<BR>Select * From &#039;Table&#039; Where...<BR>Instead of <BR>Select * From Table Where...<BR>Do like Steve says.

Posting Permissions

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