-----Original Message-----
I can see one problem right away. In the criteria of your DLookup
statements, you're not concatenating in the value from the form.
For example:
dlookup("[main item desc]", "main_item_table", "[main item code] =
[Forms]![time_entry_form]!cboMainItem.value") <<
Should be:
DLookup("[main item desc]", "main_item_table", "[main item code] = " &
[Forms]![time_entry_form]!cboMainItem.value)
This would be if the value of cboMainItem is a number. If it is a text
value, you would need:
DLookup("[main item desc]", "main_item_table", "[main item code] = """ &
[Forms]![time_entry_form]!cboMainItem.value & """")
Both DLookup statements need this correction.
For the field "format(now, "mm/dd/yyyy")", I believe you'll need the
parentheses after Now. VBA doesn't require them, but I believer the query
will. Also, Since you're only storing the Date, judging by the format, you
could use Date instead. Using Date, you could probably drop the format
statement also and just use Date.
Format(Date(), "mm/dd/yyyy")
or
Date()
To make it easier to read, you should be able to drop the ".Value" on each
statement. Value is the default property of the control and so is what will
be used if you omit it. However, this shouldn't be causing you a problem.
Are the field types you are inserting into the correct data type for the
data being inserted? This would be set in the table's design view.
--
Wayne Morgan
Microsoft Access MVP
the query is
INSERT INTO time_log_table ( [task date], [assoc number],
[main items], [sub items], [time], [entry date], notes )
SELECT [Forms]![time_entry_form]!calendar.Value, [Forms]!
[time_entry_form]!txtAssocNumber.Value, dlookup("[main
item desc]", "main_item_table", "[main item code] =
[Forms]![time_entry_form]!cboMainItem.value"), dlookup
("[subitem desc]","[subitems_table]", "[subitem code]=
[Forms]![time_entry_form]!cbosubItemsection.value"),
[Forms]![time_entry_form]!txtHoursonJob.value, format
(now, "mm/dd/yyyy"), [Forms]![time_entry_form]!
txtComments.Value;
.