On Wed, 31 Dec 2008 20:34:50 GMT, "auujxa2 via AccessMonster.com"
wrote:
>deally, I'd like to have each fixture name included so the user knows which
>fixture they're being prompted for. (fyi, all fields are text)
>
>here's my updated code, but I'm getting a missing operator syntax error.
The Insert .... SELECT syntax is for inserting data from a query into a table.
Here you're inserting specific single values (which may be an excessively
complicated way to do things; why not use a bound form!?), so you need the
VALUES keyword and another pair of parentheses. You also need quotemarks
around all of the values to be inserted into Text fields. Try
myCode = InputBox("Please enter the count for " & ctl.ItemData(varItem))
strSQL = "INSERT INTO [SpringUnitCapacities_Tbl] (Store, DeptNo,
FixtureNo, Quantity)" & _
"VALUES( '" & Me.cboAddNewStore & "','" & Me.cboAddNewStoreDept & "',
'" & ctl.ItemData(varItem) & "','" & myCode & "');"
This will expand into something like
INSERT INTO [SpringUnitCapacities_Tbl]
(Store, DeptNo, FixtureNo, Quantity)
VALUES( 'StoreName','Housewares','Skillet','HW3123');
If any of the store names, departments or items may contain apostrophes,
replace the ' delimiters in the strSQL expression with two consecutive " marks
(double doublequotes in a doublequote delimited string will become a single
doublequote).
--
John W. Vinson [MVP]
>> Stay informed about: Prompt User for value