Question : Adding value to list box

How do I add the selected value from a combo box to a list box.  The list box is bound so using lstboxname.additem generates error that rowsource must be Value List.  Please help

Answer : Adding value to list box



I believe Hawkvalley1's code is VB, which is not syntactically equivalent to Access VBA.
In Access VBA, you cannot set the value of a variable in a Dim statement.


What are the data types of the fileds in question?
I'm guessing that ID is numeric (no delimiters needed) and ProjectNumber is text (needs quotes to delimit text). Look closely at the quotes surrounding Project Number - there are embedded single quotes:

strSQL = "INSERT into tblPCRs (pcr_ID,[Project Number]) VALUES (" & Me.cboChgControlList & ", '" & Me.TxtProjectNumber & "')"

Alternatively:

strSQL = "INSERT into tblPCRs (pcr_ID,[Project Number]) VALUES (" & Me.cboChgControlList & ", " & chr(34) & Me.TxtProjectNumber & chr(34) & ")"


Random Solutions  
 
programming4us programming4us