David wrote:
DoCmd.RunSQL "INSERT INTO [tblCernerHours] ([EmpNbr]) VALUES
([EmpNbr]);"
David, you need to concatenate a couple of strings here. You are trying
to insert the current value of the EmpNbr field *in the record you are
creating* into that field *in the record you are creating*.
But that field doesn't have a value yet, since you just created the
record. So you are taking a null field value and inserting it back into
the same field in the same record.
try "INSERT INTO [tblCernerHours] ([EmpNbr]) VALUES (" & 12345 & ")"
where 12345 is whatever the actual employee number happens to be.
So you are starting off with the first part of a string that includes
your SQL clause up to the left-parens after VALUES, then concatenating
in the actual value of your EmpNbr control on the form, then adding the
closing parens in a third string. All that gets rolled into one long
string, and that is executed by the RunSQL command.
HTH,
--
Terrell Miller
mi******@bellsouth.net
"Every gardener knows nature's random cruelty"
-Paul Simon RE: George Harrison