Moving to Subform

BillBee

Registered User.
Local time
Today, 14:05
Joined
Aug 31, 2008
Messages
137
I have a main form containing a subform. On the main form I have 4 drop down list to select data from. The first three lists are used to create an unique ID for that record. At present to move to the Subform I have used a control to close and reopen the main form. I now have to use a separate drop down list to find the new record. Is there a simpler way to move to the subform. Thanks
 
Sounds like you need to just add a save record command to be able to move to the subform. I don't think you should be creating the unique id for the records (let Access take care of that by use of a simple Autonumber). You should not be concerning yourself with the inner workings of relating records, but you can still have your number if you are going to use it visibly. But if you set the Main form to have a record ID of an autonumber and then the subform has the same field but as a Long Integer as the foreign key, then it is very simple and Access handles all of that for you.

You and the users don't need to see that happening in the background at all.

So, if you do that, then you don't have much of a problem.

You can, however, implement it so that the subform is not visible until the number is created and then a button clicked (which can save the record). The code would simply be:

Code:
If Me.Dirty Then Me.Dirty = False

But I still advise you to rethink trying to build a key manually. It isn't necessary and is more likely to have problems than if you just let the system handle what it is good at and you handle other items.
 
I have tried to attach a file to view what I am talking about. Not sure about the code you have suggested.
 

Attachments

See if this works for you. I made a modifcation to one of the tables (to add its own primary key) and to the relationships.
 

Attachments

No Bob. It is not working properly. This is what I have found so far. I have switched the Judge Combo Box to right hand side. (because it was not related to the new RiveyID) When I now click on the Add New Record a new ID appears in the subform but when I move to the add a score to the first box the ID reverts the last entry and the new ID cannot be accessed. If I add new data to all Combo boxes those records do not appear in the Select Existing Record Combo at the top of the Form until I close and reopen the Form.
 
Moved Me.requery from Form to first of combo boxes and that has solved problem.
 

Users who are viewing this thread

Back
Top Bottom