Form to subform communication (1 Viewer)

Randomblink

The Irreverent Reverend
Local time
Yesterday, 21:45
Joined
Jul 23, 2001
Messages
279
Ok...
I have two tables that have related information. In one table I store all of the data concerning work projects. In the other table, it holds contract ammendments concerning those projects. I have the two tables related by a field called [PROJKEY]. In the main table (BASPROJINFO) the [PROJKEY] is an Autonumber that increments as each project is added, this identifies each project with a number ONLY the database knows and stores. In the other table (CTRCAMD) the [PROJKEY] is a simple text field.
I have two different forms I use to imput information. One forms is for NEW ONLY. No editing allowed. It is set with DataEntry to YES. This form has a subform to the (CTRCAMD) table so that as I enter a new project, if there are already some ammendments I can enter them then. The other form I created is a duplicate of this form, except it has a lookup field, and is NOT set to DataEntry.
The EDIT form works fine, I can input new or add contract ammendments no problem. The other form, for NEW ONLY, when I get to the subform part and want to add some ammendments, the form is empty, no blank fields for adding. And since this is a the first entry of this project information, it can't even reference previous ammendments. It just sits there blank...no fields.
Can someone point out what is wrong? Right now if I want to put ammendments into a project, I have to finish the data entry form and then open the edit form and drop them in there??? ARGH!
Should I just remove my subforms from the NEW ONLY form and deal with only inputting contract ammendments in the EDIT form? Or is there a solution? HELP ME!
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 22:45
Joined
Feb 19, 2002
Messages
43,346
I hope you meant that CTRCAMD.PROJKEY is a plain NUMERIC field (field size = long integer), not text.

You only need a single form. If you want the user to specify add/update/or view mode before entering the form, look up the OpenForm Method and see how to specify the datamode as the form opens. This will allow you to maintain a single object but have it work differently in different situations.

Make sure that the master/child links defined on the main form are correct. It sounds like they are not for your current "add only" version.
 

Randomblink

The Irreverent Reverend
Local time
Yesterday, 21:45
Joined
Jul 23, 2001
Messages
279
Yeah, NUMERIC field...er, that's what I said. (cough cough) So, anyway...
I have the masterlinks setup just right. Same as for the other form. And I am sure I could make it one form, BUT, on the EDIT form, I have a DropDownComboBox to search through all inputted projects. I wouldn't want that there for the NEW ONLY form, wouldn't it confuse the database?
Grrr, I used to think I was database savvy...now, I feel like going crazy!

But to pester you some more. IF I did have a SINGLE form, could I set the combobox to turn invis whenever I opened it from my menu?

You see, the ONLY difference between the two forms, is that on the NEW ONLY form, I have a ListBox that lets the user select whether the project being inputted is a CITY or CONTRACT project. When the user selects the desired one, there are several fields and pages that disappear, as well as other subforms that link to other tables.

- I just went in, created a duplicate database, and started screwing with the buttons and forms. I took the EDIT form, and created a button to ADD NEW RECORD. It said it couldn't jump to specific record. Im betting because I have the subform in it. It is linked the right way, but for some reason it just won't start a new record in my subform! ARGH!
 

Randomblink

The Irreverent Reverend
Local time
Yesterday, 21:45
Joined
Jul 23, 2001
Messages
279
I figured it out!
Thank you thank you...
I had set the AllowEdits to NO.
This locked up my darn subforms and everything!!! YIPPEEEE!
Now I got it figured out...thank you all!
 

Users who are viewing this thread

Top Bottom