Private Sub Command5CloseButton_Click() On Error GoTo ErrProc If Me.Dirty Then DoCmd.RunCommand acCmdSaveRecord End If DoCmd.Close ExitProc: Exit Sub ErrProc: Select Case Err.Number Case 2501 Case Else Msgbox Err.Number & "--" & Err.Description End Select Resume ExitProc End Sub
Hi. Unfortunately, this would be a chicken and egg situation. If the subform is bound to a child table of the main form, then you cannot create a record in the subform until you have a parent record in the main form. But if you're saying you don't want to save the new record on the main form unless there's a record in the subform, then you can't create a record in the subform because there is no parent record yet.DBguy - I want to also force an entry by the user, for a Location in the subform.
I've tried a few things but no dice....
I was thinking to set the focus to the control cboLocation1 and then using,
DoCmd.GoToRecord , , acNewRec.
I just can't seem to make it work.
Hi. I still think the same as before, but give it a try, so we can know for sure. Let us know how it goes...Could I force the subform to be dirty if the parent form is dirty?
I put the * Tag on the subform and the subform control I want filled so if the subform is dirty it seems to work.
Thoughts on that approach?
Hi. As I have been trying to tell you, this is a Catch-22 situation. The only way I know it can be done is if you use unbound forms (or forms bound to temporary tables). But if you find a different solution than that, then it would be interesting to know it. So please, make sure to share it with us. Good luck!I'm still at a loss in figuring out how to force the user to enter data in the subform, F_Location. The subform is a continuous form with only on control, cboLocation1.
I'm sure this too should be in the Before Update Event of the parent form, F_Project, but I've tried a couple of ideas after searching the internet for hours now.
Can someone give me hand?
I'm sure this has been done many times before but I can't seem to find it explained anywhere.
Thanks for any help!
Unfortunately, no, it does not make a difference. Like I was saying, this is a chicken or egg or catch-22 situation. To save a record in the child table, you need a parent. But you're asking not to save the parent without a child, which is almost impossible.DBguy,
The subform is bound to its own table. (It’s actually a junction table for later use) But it’s not bound to the table of the parent form.
I thought that is what you meant in your previous post.
Does that make a difference or am I still missing the point?
Please quote the question you're answering, and you won't get that notice. Also, it will confirm which question you were answering.No
(Message needs 10 characters or won’t send)