Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

displaying navigation buttons by code

Status
Not open for further replies.

Cosette

Technical User
Nov 30, 2004
98
US
Hi all,

I have a form which I open in two different ways. One is an open to a new record, while the other is with a filter. I wish for the same form to appear with navigation button in one instace and not the other, can that be done?

Also, along these lines, how do I get to save a form format. I do not wish for a form to open full screen every time, but to open to the custom size I created for it. Is there code to do that?

Thank you

David
 


Private Sub Form_Load()
Me.NavigationButtons = False
End Sub
 
to open Maximized
DoCmd.Maximize
to restore back to original size
DoCmd.Restore

PaulF
 
Using .Maximize and .Restore will work, but will cause ALL forms to open similarly. Try making your form a pop-up. Then, you control it's size and location on screen.


Randy
 
Randy,

What do you mean by pop up? I have set up an unbound form frmmaster with command buttons to open all my other forms. Is that what you mean by popup? If so, it still doesnt' seem to work. I set frmMaster as maximize, yet when i open a 'pop up' form as restore, the frmMaster becomes restored as well. I guess I am missing something. Is the command line on the Open or on the On Load?

David
 
Why no one was suggesting OpenArgs?
First declare OpenArgs of the form you want to open

Code:
Private Sub Form_Load()
Select Case Forms!FrmEmpMaster.OpenArgs
[green]'Opening from Employees Listview on frmStartup subform===========[/green]
   Case "[purple][b]FrmEmployees[/b][/purple]"
         Me.TabCtl2.Pages(1).SetFocus
         Me.AllowEdits = False
         Me.Caption = "Details of " & Me.Text16.Value        
         Me.cmdCanelMasterForm.Visible = False
         Me.cmdNextMain.Visible = False
         Me.cmdStart.Visible = False
         Me.CmdMainSaveClose.Caption = "Close"         
[green]'Opening for New Employee entry =============================[/green]
   Case "[purple][b]NewEmployee[/b][/purple]"
         Me.Caption = "New Employee"
         Me.EmployeeID.SetFocus
         Me.CmdMainSaveClose.Enabled = False   
End Select
End Sub
Then add OpenArgs to the command that you use to open the form
Code:
Private Sub NewEmployee_Click()
On Error GoTo Err_NewEmployee_Click
    Dim stDocName As String
    Dim stLinkCriteria As String   
    stDocName = "FrmEmpMaster"
    DoCmd.OpenForm stDocName, , , , acFormAdd, acDialog, "[purple][b]NewEmployee[/b][/purple]"
  Call FillListViewEmployees
Exit_NewEmployee_Click:
    Exit Sub
Err_NewEmployee_Click:
    MsgBox Err.Description
    Resume Exit_NewEmployee_Click
End If
End Sub
You have to change the [purple]purple bold [/purple]text for each command
regards

Zameer Abdulla
Visit Me
Where to pay your [purple]Tsunami[/purple] relief donations?
 
In design mode, open the form's properties window. Select the "Other" tab and you will see the Pop Up property. It defaults to No. Change it to Yes. Now, click the form's restore button (upper right corner of form) and size it as you desire.


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top