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!

opening 2 different forms from the same module

Status
Not open for further replies.

dixxy

Technical User
Mar 4, 2003
220
CA
Hello,

I am wondering the following question.

In my database i used the 'default' Access switchboard as start-up form. This switchboard has many buttons and menus. 2 of those open the same form in different state.

example: button 1 opens form Jobs in 'Add Mode'
Button 2 opens form Jobs in 'Edit State'
each button is connected to a different macro, that each run a seperate module that open the same form 'frmJobs' in diferrent states, Add or Edit.

My question is as follow: I would like to be able to use these same modules, but to open a different form the same way has i open frmJobs.

Here are the modules that the 2 different macro's run:

Add mode
Code:
Public Function OpenFormAdd()

Dim State As Integer
Dim stDocName As String
stDocName = "frmJobs"

DoCmd.OpenForm stDocName, , , , acFormAdd
'MsgBox "open in add mode"
'Forms!frmJobs.cmdSearch.Visible = False
Forms!frmJobs.Text179.Value = 0
Forms!frmJobs.cmdSearch.Visible = False
End Function
Edit mode
Code:
Public Function OpenFormEdit()

Dim State As Integer
Dim stDocName As String
stDocName = "frmJobs"

DoCmd.OpenForm stDocName, , , , acFormEdit
'MsgBox "open in add mode"
Forms!frmJobs.JobNumber.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70
Forms!frmJobs.cmdNew.Visible = False
Forms!frmJobs.Text179.Value = 1
Forms!frmJobs.Label95.Caption = "Search Form"
Forms!frmJobs.CustomerType.Locked = True
DoCmd.GoToRecord , , acFirst
If Forms!frmJobs.Text179 = 1 Then
Forms!frmJobs.cmdCancel.Enabled = True
End If
End Function
Is there a way to find out where the click event took place from the Access switchboard to be able to change dinamically the 'stDocName'?

Thanks,

Sylvain
 
since we are on the subject of debuging, why is it that when i set a breakpoint nothing hapens?

Thanks,

Sylvain
 
Add an additional breakpoint for the same line in the [blue]'Open a form[/blue] section and test again . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top