Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Combo Box syntax for Update Query

Posted on 2006-03-24
4
Medium Priority
?
768 Views
Last Modified: 2008-01-09
What is the correct syntax for a combo box value in an update query?

Private Sub Combo91_Click()
Dim sql As String
               
 sql = "update [Roll Exception Report] set [Denied/Approved Mandatory] =  [combo91.value] where [company number] = " & Me.[Text38]
 CurrentDb.Execute sql, dbFailOnError
 Me.Refresh

End Sub


I get an error [Combo91.value]

Any help would be appreciated!!
0
Comment
Question by:ca1358
  • 3
4 Comments
 
LVL 19

Expert Comment

by:dmitryz6
ID: 16285009
if [Denied/Approved Mandatory] is numeric

sql = "update [Roll Exception Report] set [Denied/Approved Mandatory] ="  &me.[combo91].value & " where [company number] = " & Me.[Text38]

if [Denied/Approved Mandatory] is string

sql = "update [Roll Exception Report] set [Denied/Approved Mandatory] ="""  &me.[combo91].value & """ where [company number] = " & Me.[Text38]
0
 
LVL 19

Accepted Solution

by:
dmitryz6 earned 2000 total points
ID: 16285026
does it MS Access?

will be
if [Denied/Approved Mandatory] is numeric

sql = "update [Roll Exception Report] set [Denied/Approved Mandatory] ="  &me.[combo91] & " where [company number] = " & Me.[Text38]

if [Denied/Approved Mandatory] is string

sql = "update [Roll Exception Report] set [Denied/Approved Mandatory] ="""  &me.[combo91]  & """ where [company number] = " & Me.[Text38]
0
 

Author Comment

by:ca1358
ID: 16285066
sql = "update [Roll Exception Report] set [Denied/Approved Mandatory] ="""  &me.[combo91]  & """ where [company number] = " & Me.[Text38]


this worked but before I close this out, could you please tell how to stop the "write conflict" when it hits
me.requery

Thank you very much!!
0
 
LVL 19

Expert Comment

by:dmitryz6
ID: 16290050
You probably updating same table as record source of your form,may be better to
bound combo91 to Denied/Approved Mandatory field
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Suggested Courses
Course of the Month15 days, 7 hours left to enroll

575 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