PDA

View Full Version : Adding New Data to an Existing Record



nardella
09-02-2010, 07:31 AM
I am working on a database with two related tables - similar to a database that has one table with a list of clients and a related table that holds each client's order.

My primary table tracks the progress of our company projects through a series of processes across different business areas. The second table (an actions table) has been designed to provide additional information for a specific department and the actions taken by this department for each company project . For any particular project, there will be multiple actions.

I have created a primary form that will display the details of the primary table (which, again, tracks the life of a project). I have added a control on this main form to open an actions form.

HERE'S WHERE I'M STUCK.

I need the actions form to open as a new record for the currect project.

Imdabaum
09-02-2010, 10:25 AM
I think in the properties of the Action form you should be able to set Allow Additions to Yes, and all other allows to No in order to force the form to only show new records.

CreganTur
09-02-2010, 11:44 AM
Actually you can just set the Data Entry property of the form to True- this makes it into a data entry only form- it will always open to a New record. Using Data Entry means you cannot use it to show existing records.

Imdabaum
09-02-2010, 02:26 PM
Ahh. Thanks Cregan.

nardella
09-08-2010, 05:46 AM
OK, I've set the data entry field to "yes" on the second form. Thanks.

How do I get it to recognize the current project? I need to add new entries for the project at hand.

CreganTur
09-08-2010, 12:35 PM
How do I get it to recognize the current project? I need to add new entries for the project at hand.

I have no idea what you mean by this. Can you explain?

Hathman
09-08-2010, 02:16 PM
There are many ways to do this. Here is one:

If you're opening up your Actions form from your Primary form (and leaving the Primary form open) you can use the "before insert" event on your Actions form to set a bound field of your unique project id to the value of your project id on the Primary form.

Here is basically what the "before insert" code would look like:

Forms!Actions!ProjectID = Forms!Primary!ProjectID

That should ensure it inserts a new record with the correct project ID.