Changing a form's attributes in VB

bwyrwitzke

Registered User.
Local time
Today, 07:42
Joined
Nov 11, 2002
Messages
50
I'm sure this is an easy one, but I'm pulling out my hair trying to make it work.

BACKGROUND: I'm using Access 2000 and am opening a form through using a dialog box with 2 command buttons. One of the buttons opens a specific record (selected from a list), and the other cmd btn opens them all. The dialog box is "frmGoToModem" and the form I'm tryin to open is "frmModemSpecs."

GOAL: I'd like to hide the Navigation Buttons when "frmModemSpecs" is opened for a specific record, and make them visible when it's opened for all records.

I've tried using Forms!frmModemSpecs.NavigationButtons = False in conjunction with the cmd btn CLICK, but keep getting an error message that form 'frmModemSpecs' can't be found.

I know this is minor, but it's driving me crazy. Any help would be appreciated. Thanks.

Bruce
 
Bruce,

The line -- Forms!FrmModemSpecs.NavigationButtons = False -- is OK but it should be put in FrmModemSpecs' Open Event. Right now it's running before the form is opened, so it can't find the form and make the change.

Additionally, you'll need to pass an argument to "tell" the code in the form's open event whether or not to show or hide the navigation buttons.

In the On Click event of the command button that opens FrmModemSpecs put something like this:

'pass an argument to the form
DoCmd.OpenForm "FrmModemSpecs", , , , , , "NoNav"

Then in the on Open event of frmModemSpecs, put something like this:

Private Sub Form_Open(Cancel As Integer)

'is something being passed my way?
If len(me.OpenArgs) > 0 then
'yes, so turn off buttons
Forms!FrmModemSpecs.NavigationButtons = False
End if

Regards,
Tim
 
DoCmd.OpenForm stDocName, , , stLinkCriteria
Forms!MyForm.NavigationButtons = False
works fine in 97
 
Thanksw for the help...

I was headed in the right direction, just got hung up on the order (can't help it, I've only been doing this since Monday). The code works great as long as DoCmd.OpenForm is executed before Forms!FrmModemSpecs.NavigationButtons = False.

Thanks again to everyone who provided help.

Bruce
 

Users who are viewing this thread

Back
Top Bottom