Several things...
You are using "Date" as a field name (after spotperweek). If your table truly has a field called "Date" you will have to put [] around the field like
Code:
spotperweek, [date],
Frankly, I recommend you rename the field.
You need to change "value" to "Select".
You need to drop the parenthesis around the Select. So, after you change "value" to "Select", remove the next ( and remove the ) inside the quote on the last line.
This isn't causing the problem, but the 3rd, 4th and 5th lines don't need the
at the end of the line because you put the close quote for your text on the next line.
To debug this yourself, open the query builder and paste the statement. Remove all of the
VB syntax (the quotes on the strings, the ampersands and the underscores). Change the the field names to sample values. E.g.
Code:
'" & txtspotwk & "'
becomes
Then try to view the query.
If I was writing this, it would be like:
Code:
Dim strSQL as string
strSQL = "insert into broadcast_orders (stn_call, start_date, " _
& "end_date, total_weeks, employee, client, WEMG_rate, spotperweek, " _
& "abetternamedfieldfordate, " _
& "order_num) Select '" & lstAllOwner.ItemData(i) & "', " _
& "#" & datestart & "#, #" & dateend & "#, '" & txtTotWeeks & "', " _
& "'" & cboemployee & "', '" & txtclient & "', '" & txtRate & "', " _
& "'" & txtspotwk & "', #" & txttodaydate & "#, '" & txtordernumb & "'")
Debug.print strSQL
DoCmd.RunSQL strSQL
Notice, by building the string before the RunSQL, I can use "Debug.Print" to see the actual SQL statement. I can then take that SQL statement to query builder and find out what is wrong. When the code is correct, I remove (or comment) the "Debug.Print".
NOTE: Beware of your text fields having immbedded quotes (") or apostrophies ('). This will hose your SQL statement. If that's a possibility, you should open an RecordSet for append and set the fields one at a time.
Give the man a fish, he eats for a day. Teach the man to fish...
Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org