Navigation Form BrowseTo

ArmyHorn

New member
Local time
Yesterday, 17:17
Joined
May 3, 2013
Messages
4
Hi Folks,

I'm working on the Navigation Form template in Access 2010, which is new to me. It appears that one needs to use the BrowseTo command to open up a form in the built-in subform module. I'm trying to create a couple of buttons where each button opens a form in a different data mode; one in read-only and one in add mode. Here is the syntax I used for read-only:

DoCmd.BrowseTo acBrowseToForm, "frmSales","frmNavigation.NavigationSubform", , ,acFormReadOnly

frmSales is the Sales form I want both of the buttons to open and frmNavigation is the Navigation form. It seems to be ignoring the data mode part at the end however. It only will open in Edit mode. Is there something I'm doing wrong with this command?

ArmyHorn
 
I think the commands inside the form override the open options. When you have the form in design mode, and you are viewing the form options, not detail or pageheader, but the form, you will see on the Data tab a bunch of options for editing. These options take precedence.

To do that I would suggest using an opening argument, like a one or two.

Put this in the onclick event of the read only button
DoCmd.OpenForm "frmNavigation", , , , , , 1

Put this in the onclick event of the change button
DoCmd.OpenForm "frmNavigation", , , , , , 2

Then in the onload event of the form, you put a case statement or if statement like:

If me.OpenArgs = 1 then
Me.AllowAdditions = False
Me.AllowDeletions = False
Me.AllowEdits = False
else
Me.AllowAdditions = True
Me.AllowDeletions = True
Me.AllowEdits = True
end if

As far as a sub form is concerned, you don't explicitly open a sub form. With the main form open in design mode, you literally drag the sub form into it, position it, and establish a link between the two. This last part is done by viewing the property sheet on the sub form, once in the main one, and getting the common index key in the Master/Child fields.

If you mean that you want to change the sub form status, you reference it from the buttons on the main form.
Me.NavigationSub.AllowEdits = False

Anyway, I hope that helps.
 
Thanks for the reply Privateer. I don't think we're quite on the same page, so I'll take another stab at the explanation.

I'm using the Navigation Form templete from Access 2010. In that template there is a subform control you can use to open other forms (or reports). In order to open a form there, you must use the BrowseTo command (I believe). So unfortunately, I cannot use OpenForm and BrowseTo does not have an OpenArgs argument.

Does anyone know why BrowseTo is ignoring the DataMode argument I'm using?
 
Just to give a final update on this issue...

I was never able to figure out why it was ignoring the data mode part of my BrowseTo command. I tried many different configurations, forms, etc. It was always ignored. Perhaps some undocumented Access bug?

Anyway, I worked around it by creating a global variable that was set by the Navigation Form and created code in the OnLoad event of the Sales form to set the properties of that form. Similar to Privateer's suggestion, but using BrowseTo instead of OpenForm. It's a little clunky, but seems to work.

ArmyHorn
 

Users who are viewing this thread

Back
Top Bottom