Update next record while still on current (1 Viewer)

Scottyk537

Registered User.
Local time
Today, 14:40
Joined
May 25, 2006
Messages
48
I have a form(F_Roll) that runs from a query(Q_roll) which asks the user to input the date. New records are made from this form, and it also allows the user to look at the records from past dates. On this form, my next button creates a new record for that date and fills a field called "RollNumber" with a running counter based on the CurrentRecord. If no roll is present for that date, "RollNumber"=1. If the "Next" button is pushed and "RollNumber"=1, then on the next record, "RollNumber" is filled with 2. If 2 then 3,etc. "RollNumber" is my primary key for the table(T_Roll), and actually, I have the date in front of the counter. The data in "RollNumber" is like "071206-1", "071206-2", "071206-3", "071206-4", etc.
What I want to do is have a button on my main form(F_Roll) that will open a new modal, pop-up form on top of my main form that allows the user to enter data for the next record(roll) while still on the current record(roll).
I can get it to work if the next record(roll) has already been made. But if I make a new record through the pop-up form and then try to goto the next record I my main form, I get a primary key error about making duplicate primary keys when trying to save the record.
The problem is(I think)- The query for the main form has already ran, so it doesn't recognize the new record made from the pop-up form. When the next button is pushed, it is creating a duplicate record(roll) in the primary key.
Does anyone have any ideas how to work around this?
I am using Access 2003
 

Sergeant

Someone's gotta do it
Local time
Today, 15:40
Joined
Jan 4, 2003
Messages
638
If you wish to do it the way you described, perhaps you should have the popup form load the current record and then move the main form to a new record? You might even do it with an unbound subform to keep it all on the same page.
 

Users who are viewing this thread

Top Bottom