Solved

SQL SYNTAX AND VBA

Posted on 2008-10-06
2
215 Views
Last Modified: 2013-12-25
I need to modify this piece of VBA code to do something a lot simpler. For the selected record, write to a new field I created STATUS = '1' that I created in the [Cient List] table.

Public Sub CloseFile(CNumber, Box, Reason As Variant)
    Dim SQL As String    
    'SQL = "INSERT INTO [Closed Files] (CaseNumber, FullName, Address, City, State, Zipcode, Telef_Home, Telef_Cell, Box, Reason)" & _
    '      "SELECT CaseNumber, (FullName, Address, City, State, Zipcode, Telef_Home, Telef_Cell, " & Box & ", '" & Reason & "'" & _
    '      "FROM [Clients List] " & _
    '      "WHERE [Clients List].CaseNumber = " & CNumber
    'DoCmd.RunSQL SQL
End Sub
0
Comment
Question by:gabepcsolutions
2 Comments
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 500 total points
ID: 22653136
SQL = "Update [Client List] Set Status=1 " & _
"WHERE [Clients List].CaseNumber = " & CNumber
0
 

Author Comment

by:gabepcsolutions
ID: 22653241
Thanks! ...a detail, was missing the  '1'
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

919 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

12 Experts available now in Live!

Get 1:1 Help Now