Solved

SQL Append looking for end of statment

Posted on 2011-03-24
4
371 Views
Last Modified: 2012-05-11
Dim strSQL As String
    Dim RecordName,tableName As String
    RecordName = Me.rHid  'changed to Rused- name conflict?
    TableName= "table" & me.RN
        strSQL = "INSERT INTO tablename ( rHid, Fps1, Fps2, Fps3, Fps4, Fps5, Fps6, Fps7 )" _
       "SELECT test.rHid, test.Fps1, test.Fps2, test.Fps3, test.Fps4, test.Fps5, test.Fps6, test.Fps7" _
       "FROM test WHERE (((test.rHid)="RecordName"))"

 
    strSQL = "INSERT INTO tableName ( rHid, Fps1, Fps2, Fps3, Fps4, Fps5, Fps6, Fps7 )"
    strSQL = "SELECT test.rHid, test.Fps1, test.Fps2, test.Fps3, test.Fps4, test.Fps5, test.Fps6, test.Fps7"
    strSQL = "FROM test WHERE ((test.rHid) = "Rused"))"
                                                             highlights ^^^^^  
  CurrentDb.Execute strSQL, dbFailOnError
I tried extra ",extra() and spaces and  the two types above
BTY is one better than the other?
0
Comment
Question by:afreer2
  • 3
4 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 500 total points
ID: 35211993
did you try single-quotes?

strSQL = "FROM test WHERE test.rHid = 'Rused' "
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 35211998
... and you did have one extra ) in your last statement above, after .rHid
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 35212007
and if you need to use double-quotes, you need to double them up for VBScript:

    strSQL = "FROM test WHERE test.rHid = ""Rused"" "
0
 

Author Comment

by:afreer2
ID: 35212026
Single quote worked
Always can depend on Experts Exchange..
thanks
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now