DoCmd.RunSQL combobox column

  • Thread starter Thread starter finster26
  • Start date Start date
F

finster26

I am not sure what is wrong with the statement:

DoCmd.RunSQL "INSERT INTO CaseAddresses ( [Address] ) VALUES
(Forms![AddressManager].Form![cmbAddress]![Column(2)])", -1

I have a combo box and I am trying to take the value from column 2 of the
combobox and have it enter as a new record in the CaseAddresses table in
field Address. It adds a new record but it's blank in the Address field. I
have the correct column.
 
The reference to the control has to be outside of the quotes.

DoCmd.RunSQL "INSERT INTO CaseAddresses ( [Address] ) " & _
"VALUES ('" & Forms![AddressManager].Form![cmbAddress]![Column(2)] &
"')", -1
 
Back
Top