Upening subform in data entry mode

tranchemontaigne

Registered User.
Local time
Today, 10:15
Joined
Aug 12, 2008
Messages
203
I have a parent form "frmMainMenu" that forms the shell of my user interface. Everything in the database is done through a subform. Command button behavior is table driven similar to the "switchboard" template that comes out of the box, except that I have added additional arguments (e.g. form caption) and options (e.g. change subform)

The problem I have is that I want to have data entry through a subform and can't get it to work...

I have gone to the subform and set the DATA ENTRY property to YES with no luck.

I then tried using an OnOpen event for the subform that would move to a new record

DoCmd.GoToRecord , , acNewRec

with no luck

trying to do these two things at the same time through code also fails (not surprisingly)

Me.DataEntry = True
DoCmd.GoToRecord , , acNewRec

Every time I open the form it goes to the first record. The subform is bound to a single table so joins are not muddling the works.

Making the subform unbound and using an append query is not a viable option due to string length issues.

Any thoughts would be appreciated.:)

[Edit: As you may have already guessed, the subform is not bound to the parent form]
________
Nevada Medical Marijuana Dispensary
 
Last edited:
With data entry = Yes, try acLast instead of acNewRec in the DoCmd.Goto.

Just a guess.....

FYI: If you have a refresh or requery in your code, that will set the continuous form to the first record. Do the GoTo after the refresh/requery.
 
In the main form's On Load event use this:

Code:
Me.YourSubformContainerNameHere.Form.Recordset.AddNew

Where YourSubformContainerNameHere is the name of the container that houses the subform on the main form. It may, or may not, be named the same as the subform so be sure to look and use the container name instead of the subform name if it is different.
 
Also, you need to check the AllowAdditions Property of the main form. Unless my memory is failing, all of the things you've tried with the subform are really futile. Regardless of how these things are set in the subform's source, when used as a subform, the form is ruled by the "Allow" properties of the main form! If the main form's AllowAddirtions is set to No, you can't add records to the subform.
 
Missingling,

Thanks for the tip. I checked the properties of the parent form "frmMainMenu" and saw that it has the following data properties:

AllowFilters = No
AllowEdits = Yes
AllowDeletions = No
AllowAdditions = Yes
DataEntry = No

The subform has the following data properties


AllowFilters = Yes
AllowEdits = Yes
AllowDeletions = Yes
AllowAdditions = Yes
DataEntry = Yes

Any other ideas?
________
Grow medical marijuana
 
Last edited:
BobLarson,

I added the following code

Private Sub Form_Load()

[Forms]![frmMainMenu]![frmSubform].[Form].Recordset.AddNew

End Sub

And am the subform still opening to the first record. I knopw it's redundant, but adding the extra code of

DoCmd.GoToRecord , , acNewRec

or

DoCmd.GoToRecord , , acLast

appear to be ignored

If it makes any difference, I'm using MS Access 2000.
________
Ford Bronco Ii Specifications
 
Last edited:
Where are you performing the DoCmd? It should be on the Mainform OnCurrent Event.
 
MagicMan,

This fails to work for me too. Thanks for the thought though.

NOTE: I also tried setting the DataEntry property at the same time that the source object property is set and found that this doesn't work either.
________
Health Shop
 
Last edited:
As I said in post #2, a requery will set the record to the first record. Your code
Code:
With [Forms]![frmMainMenu]
        ![frmSubform].SourceObject = strSubform
        ![lblTitle].Caption = strCaption
        ![frmSubform].Requery
End With
does exactly that. When I comment out the Requery, it works fine!
You do have a couple other switchboard issues, but I am sure you can handle those.
Smiles
Bob
 
Smiles,
Switchboard is great but sometimes hides the obvious.
Glad to help.
Smiles
Bob
 

Users who are viewing this thread

Back
Top Bottom