hi,
try this
add a dim
dim db as database
add a line
set db = codeDb()
Set rst = CurrentDb.OpenRecordset("[Head count extra time tbl]",dbOpenDynaset)
this is the same syntax i use with recordset that work. if this doesn't work
then something else is the problem. are you sure this is the line it is
crashing on?
post back if problems
regards
FSt1
> FST1,
>
[quoted text clipped - 112 lines]
> > >
> > > End Sub
Pele - 29 Jul 2005 21:36 GMT
Fst1,
I tried the additional code you'd provided and I got the following error
message:
The microsoft Jet database engine cannot find the input table or query
'[Head Count extra time tbl]'. Make sure it exists and that its name is spekt
correctly'.
I then took out the brackets from the name and reran it but it gave me the
eror message "Object variable or with block variable not set" and it then
gets stuck as before.
I know the line that is problematic because I put a msgbox before and after
that line and the msgbox before is the only one that gets displayed i.e. the
code stooped at that line. To make sure I didn't make a mistake in the name,
I copied the name from the table itself and it still didn't work.
Pele
> hi,
> try this
[quoted text clipped - 130 lines]
> > > >
> > > > End Sub
Pele - 29 Jul 2005 22:12 GMT
Fst1,
I apologize for this but your code was correct. I had made a mistake in the
name of one of my fields and that was the problem all along.
In the code below, I had been mistakenly using HC-ID instead of [HC ID].
Once I changed it, the code worked fine.
Thanks for your help.
Pele
Set rst = CurrentDb.OpenRecordset("Head count extra time tbl", dbOpenDynaset)
'Set rst = CurrentDb.OpenRecordset("[Head count extra time tbl]")
With rst
For i = SW To EW
' Add new record.
.AddNew
![HC ID] = varHDCT
!Week = i
> hi,
> try this
[quoted text clipped - 130 lines]
> > > >
> > > > End Sub