form/subform adding new record problems.

  • Thread starter Thread starter bbango
  • Start date Start date
B

bbango

Guest
Hey everyone, This seems like a great community for access - I'm glad I stumbled across here because I have some issues that need figured out.

I've searched the forum for answers and I have found a few posts with suggestions, but nothing has worked yet. (by the way, I'm fairly new to access, but not to databases in general).

So here's my problem, and I appreciate any help in advance.

- I have a main form and 2 subforms on the main form. The main form contains the information of thousands of Titles to different sections of land. The one subform then has multiple "requirements" per Title. So i have a many-1 relationship between the requirements and titles. On the main form, there is an edit button - so everything is locked until the user hits the edit button, and then the main form becomes editable. The requirements subform does not - it stays locked even though in my code I have "Me![Requirements Subform].Locked = False"

But this is not my main concern right now. What gets me is that I can not add a new record from the requirements subform. For example, Title 1 (T-0001) has 11 different requirements. I can use the navigation to browse through the requirements but I can not add a new requirement from the navigation buttons. This is a main concern.

Another main concern is that when I add a new Titles record from the navigation buttons, my requirements subform disappears from the form.

I hope I explained my situation clearly! if anyone needs any clearification, let me know.

Thanks again,
Brandon
 
I guess we will need to see all the codes or maybe you can zip a sample of it and post it here.
 
ok....

okay, here is the code when the main form loads on the form current event.

Private Sub Form_Current()
If IsNull(Me![Title #]) Then
Me.AllowEdits = True
Me![Requirements Subform].Enabled = True
Me![Requirements Subform].Locked = False
Else
Me.AllowEdits = False
Me![Requirements Subform].Enabled = True
Me![Requirements Subform].Locked = True
Me![Titles/Land Information Subform].Enabled = True
Me![Titles/Land Information Subform].Locked = True
End If
End Sub


-------------------------------------
Here is the code when the user clicks the "Edit button".

Private Sub Edit_Button_Click()
Me.AllowEdits = True
Me![Requirements Subform].Enabled = True
Me![Requirements Subform].Locked = False
'Me![Titles/Land Information Subform].Enabled = True
'Me![Titles/Land Information Subform].Locked = False
End Sub
-------------------------------------------

The main forms and the requirements subform's record sources are both linked directly to 2 different tables.

Does this help?
 
One thing I see is you should probably set a flag with your Edit button so the Current event will leave things alone after you push the button.
 
Thanks for the suggestion RG. your respond triggered my brain and I created a flag when the Edit button is clicked, and on my subform current event, i set the Me.AllowEditions = True. So now I am able to add new records to the subform and also when i create a new Titles - the subform does not disappear. Great! Thanks alot. I might run into some other questions but until then thanks again!
 
Glad to assist and thanks for posting back with your success.
 

Users who are viewing this thread

Back
Top Bottom