Let's see if I can explain this without doing my head (or yours) in. I have two tables -
tblStatusAspects is a list of 10 aspects (with an autonumber primary key field)
RAPtblStatus is the status (and other info) of those 10 aspects for the month.
I am trying to create a command button on my form that goes to tblStatusAspects and copies the 10 aspects into new records in the RAPtblStatus. I madly copied the code below on Friday from a very brief session with a very overworked Access guru, and it don't work :-(
I can go back and hassle him, but I'd actually really like to understand what I'm doing. I'm a little confused because (to me) the code seems only really be referring to one of the tables. If the form I'm in is linked to RAPtblStatus - then should I actually be opening the other table (the list I want to copy from)?
The code creates a new record, but doesn't put any info in it. The error message highlights "addnew".
tblStatusAspects is a list of 10 aspects (with an autonumber primary key field)
RAPtblStatus is the status (and other info) of those 10 aspects for the month.
I am trying to create a command button on my form that goes to tblStatusAspects and copies the 10 aspects into new records in the RAPtblStatus. I madly copied the code below on Friday from a very brief session with a very overworked Access guru, and it don't work :-(
I can go back and hassle him, but I'd actually really like to understand what I'm doing. I'm a little confused because (to me) the code seems only really be referring to one of the tables. If the form I'm in is linked to RAPtblStatus - then should I actually be opening the other table (the list I want to copy from)?
The code creates a new record, but doesn't put any info in it. The error message highlights "addnew".
Code:
Me.AllowAdditions = True
Set db = CurrentDb()
Set tblAsp = db.OpenRecordset("RAPtblStatus", dbOpenSnapshot)
tblAsp.MoveFirst
Do While Not tblAsp.EOF
With tblAsp
.AddNew
.RAPtblstatus.[ProjectAspect] = tblStatusAspects.[ProjectAspect]
.Update
End With
Loop
Me.AllowAdditions = False
Me.Command17.Enabled = False