Automatically create records in subform and nested subform

Maybe I can make a working without saving the record, if you post your database with some sample data, (I need the database because it is to much guessing how you've set it up).
 
Thanks JHB,

I will post something later.

Do you have any idea why this isn't a problem with the sample database that you posted?
 
JHB,

In the process of making the database "postable", I cleared out all the irrelevant database objects and deleted all the data.

Then, when I was making some sample records, the append functionality worked fine for the first 2 records. After that, every time I tried to append the records, I got the Primary Key violation error. I solved this by inserting:

Code:
DoCmd.RunCommand acCmdSaveRecord
I posted the database in another thread where we were discussing another problem with the same database.

You can see the code in the After Update event of cboJobType on frmProjectsNew.

If you wouldn't mind taking a look I would be grateful.

Thanks
 
... every time I tried to append the records, I got the Primary Key violation error. I solved this by inserting:
The problem rise because of the relationships, you're trying to add records to table tblAccrual, before you've a ProjectId in the table tblProjectList.
So you've done the right thing by saving the record first.
I've put in another way to save it as the DoCmd.RunCommand acCmdSaveRecord command.
 
Ahhh I see. You replaced it with:
Code:
If Me.Dirty Then
Me.Dirty=false
Good idea.

The advantage with this approach is that it only saves the record if the value has actually changed, right?

Thanks
 
From the MS-Access Help-file:
You can use the Dirty property to determine whether the current record has been modified since it was last saved.
 

Users who are viewing this thread

Back
Top Bottom