Prev: Drag a file(path) from an Access Form into another app?
Next: DoCmd.ApplyFilter generates Parameter prompt
From: finster26 on 10 Dec 2009 17:08 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.
From: Douglas J. Steele on 10 Dec 2009 17:20
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 -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "finster26" <finster26(a)discussions.microsoft.com> wrote in message news:4BFD753F-1B82-4384-AB38-BFF502C257AF(a)microsoft.com... >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. |