Odd datasheet behavior

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a form that contains a subform. I have them both set to default
datasheet view so they look like a table with the little plus sign beside
each record to show the related records from another table. When I open this
form from the database window, it opens properly and looks as described
above. However, I have a switchboard that has a button that I created with
the wizard that opens the form. When using this button from the switchboard,
the form insists on opening with the main form in single form view, and the
subform in datasheet view. My users cannot use it like this. Is there any
explanation for this behavior?

Many thanx,

RipperT
 
The code that the switchboard manager generates will open any form with a
straight docmd.openform "FormName" command - and opening it that way will
always lose the fact that you've changed the default view to datasheet. You
could just edit that code so that it used docmd.openform "FormName",acformds
but then all forms are going to open that way. So you need to play a bit to
get the code to behave itself.

Open the code behind the switchboard form and find the HandleButtonClick
code. At the top of that you'll find a number of constants defined... add

Const conCmdOpenFormDS = 10

onto that list.

Scroll down a bit and find the part that says...

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument]

...and after that add this...

' Open a form in datasheet view
Case conCmdOpenFormDS
DoCmd.OpenForm rs![Argument],acformds

Close the form down and save the code. Open the switchboard items table,
find the row where 'Argument' is your form and change the 'Command' field
from 3 to 10.

And that should do it.
 
Thanx for the help, but I'm confused about this part:
You could just edit that code so that it used docmd.openform "FormName",acformds
but then all forms are going to open that way.

Why is this? If I edit just the code behind that particular button, won't it
affect only the from which the button opens?

Thanx again,

Rip
Rob Oldfield said:
The code that the switchboard manager generates will open any form with a
straight docmd.openform "FormName" command - and opening it that way will
always lose the fact that you've changed the default view to datasheet. You
could just edit that code so that it used docmd.openform "FormName",acformds
but then all forms are going to open that way. So you need to play a bit to
get the code to behave itself.

Open the code behind the switchboard form and find the HandleButtonClick
code. At the top of that you'll find a number of constants defined... add

Const conCmdOpenFormDS = 10

onto that list.

Scroll down a bit and find the part that says...

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument]

...and after that add this...

' Open a form in datasheet view
Case conCmdOpenFormDS
DoCmd.OpenForm rs![Argument],acformds

Close the form down and save the code. Open the switchboard items table,
find the row where 'Argument' is your form and change the 'Command' field
from 3 to 10.

And that should do it.


RipperT said:
Hello,

I have a form that contains a subform. I have them both set to default
datasheet view so they look like a table with the little plus sign beside
each record to show the related records from another table. When I open this
form from the database window, it opens properly and looks as described
above. However, I have a switchboard that has a button that I created with
the wizard that opens the form. When using this button from the switchboard,
the form insists on opening with the main form in single form view, and the
subform in datasheet view. My users cannot use it like this. Is there any
explanation for this behavior?

Many thanx,

RipperT
 
No. Because the switchboard code applies to any form that you open (using
the browse option) from the switchboard.

You could edit the existing part saying...

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument]

to

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument],acformds

....to see what happens


RipperT said:
Thanx for the help, but I'm confused about this part:
You could just edit that code so that it used docmd.openform "FormName",acformds
but then all forms are going to open that way.

Why is this? If I edit just the code behind that particular button, won't it
affect only the from which the button opens?

Thanx again,

Rip
Rob Oldfield said:
The code that the switchboard manager generates will open any form with a
straight docmd.openform "FormName" command - and opening it that way will
always lose the fact that you've changed the default view to datasheet. You
could just edit that code so that it used docmd.openform "FormName",acformds
but then all forms are going to open that way. So you need to play a bit to
get the code to behave itself.

Open the code behind the switchboard form and find the HandleButtonClick
code. At the top of that you'll find a number of constants defined... add

Const conCmdOpenFormDS = 10

onto that list.

Scroll down a bit and find the part that says...

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument]

...and after that add this...

' Open a form in datasheet view
Case conCmdOpenFormDS
DoCmd.OpenForm rs![Argument],acformds

Close the form down and save the code. Open the switchboard items table,
find the row where 'Argument' is your form and change the 'Command' field
from 3 to 10.

And that should do it.


RipperT said:
Hello,

I have a form that contains a subform. I have them both set to default
datasheet view so they look like a table with the little plus sign beside
each record to show the related records from another table. When I
open
this
form from the database window, it opens properly and looks as described
above. However, I have a switchboard that has a button that I created with
the wizard that opens the form. When using this button from the switchboard,
the form insists on opening with the main form in single form view,
and
the
subform in datasheet view. My users cannot use it like this. Is there any
explanation for this behavior?

Many thanx,

RipperT
 
My apologies, I didn't notice that you said switchboard manager in your first
post. I am not using it. My switchboards are simply forms that I customize as
I go. I re-wrote the code behind the button to include:

stDocName = "frmMeetings"
DoCmd.OpenForm stDocName, acFormDS, , stLinkCriteria

and now it works fine. Sorry about the mixup and thanx for taking time to
educate me. I've learned something valuable.

Rip

Rob Oldfield said:
No. Because the switchboard code applies to any form that you open (using
the browse option) from the switchboard.

You could edit the existing part saying...

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument]

to

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument],acformds

....to see what happens


RipperT said:
Thanx for the help, but I'm confused about this part:
You could just edit that code so that it used docmd.openform "FormName",acformds
but then all forms are going to open that way.

Why is this? If I edit just the code behind that particular button, won't it
affect only the from which the button opens?

Thanx again,

Rip
Rob Oldfield said:
The code that the switchboard manager generates will open any form with a
straight docmd.openform "FormName" command - and opening it that way will
always lose the fact that you've changed the default view to datasheet. You
could just edit that code so that it used docmd.openform "FormName",acformds
but then all forms are going to open that way. So you need to play a bit to
get the code to behave itself.

Open the code behind the switchboard form and find the HandleButtonClick
code. At the top of that you'll find a number of constants defined... add

Const conCmdOpenFormDS = 10

onto that list.

Scroll down a bit and find the part that says...

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument]

...and after that add this...

' Open a form in datasheet view
Case conCmdOpenFormDS
DoCmd.OpenForm rs![Argument],acformds

Close the form down and save the code. Open the switchboard items table,
find the row where 'Argument' is your form and change the 'Command' field
from 3 to 10.

And that should do it.


Hello,

I have a form that contains a subform. I have them both set to default
datasheet view so they look like a table with the little plus sign beside
each record to show the related records from another table. When I open
this
form from the database window, it opens properly and looks as described
above. However, I have a switchboard that has a button that I created with
the wizard that opens the form. When using this button from the
switchboard,
the form insists on opening with the main form in single form view, and
the
subform in datasheet view. My users cannot use it like this. Is there any
explanation for this behavior?

Many thanx,

RipperT
 
Rob - this code worked! Thank you SO SO Much for the help!

You could edit the existing part saying...

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument]

to

' Open a form.
Case conCmdOpenFormBrowse
DoCmd.OpenForm rs![Argument],acformds

....to see what happens

[quoted text clipped - 67 lines]
 
Back
Top