Modifying/Appending records between subforms

D

David Mulholland

I need some guidance and perhaps some inspiration. I'm working on a database
containing a main form with 2 subforms side by side. Subform1 is a continuous
form that has records about the positions a military unit has. Subform2 is a
continuous form that starts out wth no records.

Basic Subform1 record fields: UIC, Para, Line, Auth Str, Req Str
Combo PK on UIC, Para, Line

What I'm trying to do is to 'maybe' click a command button on a record in
Subform 1 and have the data of that record append to Subform2. While doing
this it should subtract 1 from Auth Str and Req Str, and change the appended
record's UIC to the contents of an unbound text field on Subform2. If Auth
Str and Req Str would end up being "0", then it should append then delete
that record from Subform1. When the append to Subform2 takes place, it should
either add that record, if it doesn't exist, or add 1 to the Auth Str and Req
Str.

In case the user made a mistake, Subform 2 will have a similar command
button to carry out the same action.

I was hoping someone could point me in the right direction.
 
S

Stefan Hoffmann

hi David,

David said:
What I'm trying to do is to 'maybe' click a command button on a record in
Subform 1 and have the data of that record append to Subform2. While doing
this it should subtract 1 from Auth Str and Req Str, and change the appended
record's UIC to the contents of an unbound text field on Subform2. If Auth
Str and Req Str would end up being "0", then it should append then delete
that record from Subform1. When the append to Subform2 takes place, it should
either add that record, if it doesn't exist, or add 1 to the Auth Str and Req
Can you describe your data model?

In the most common case you have a setup like

Subform 1: SELECT * FROM query WHERE (criteria)
Subform 2: SELECT * FROM query WHERE NOT (criteria)

On your button click you'll execute an update query which changes the
record so that it would no longer match the criteria.


mfG
--> stefan <--
 
S

S.Clark

Add a button on the main form to copy the record from Sfrm1 to Sfrm2. Add
code to the button to run an append query to perform the copy. In the query,
you can add your business rules. You may need multiple queries, and to
dynamically determine which query to run based on the conditions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top