SQL update

1

123

Thank you for your help and answer:
can any one here replace for me insert into to Update in this code
-----------code start------------
Dim FormName
FormName = Screen.ActiveForm.Form.Name
Dim cdl As CommonDlg
Set cdl = New CommonDlg
cdl.CancelError = True
cdl.ShowColor
Screen.ActiveForm.Section(0).BackColor = cdl.color
Dim sql As String
sql = "INSERT INTO tblcolor (" & FormName & ") VALUES (" &
Screen.ActiveForm.Section(0).BackColor & ");"
docmd.runsql sql
----------Code end-----------------------

I want to change INSERT INTO WITH (UPDATE) any one expert in Sql can
help....thank you
 
J

John Viescas

Do you have only one row in tblColor? If so, this should work:

sql = "UPDATE tblcolor SET " & FormName & " = " &
Screen.ActiveForm.Section(0).BackColor & ";"

--
John Viescas, author
"Microsoft Office Access 2003 Inside Out"
"Running Microsoft Access 2000"
"SQL Queries for Mere Mortals"
http://www.viescas.com/
(Microsoft Access MVP since 1993)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top