If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
command button to open 1 of 2 forms
Hi All,
I have 3 forms "DailyRoute", "ServiceCall" and "Installation". "ServiceCall" and "Installation" have control source as "TblCustomers" when the customer details are entered a checkbox is check to identify a Service Call, the issue is that different information is required for each job type ("ServiceCall" or "Installation") therefore I require 2 forms for closing the days work. Is it possible to click the "update" command button in "DailyRoute" and display either "ServiceCall" or "Installation" forms depending on the checked box. Thanking you in advance GeoffK |
#2
|
|||
|
|||
command button to open 1 of 2 forms
Sure, you can even change the button caption and what happens in the click
event based upon the check box. Use the AfterUpdate event of the check box to change the caption. the use the form's Current event to call it between records. Sub chkWhatever_AfterUpdate() If Me.chkWhatever = True Then Me.cmdOpen.Caption = "ServiceCall" Else Me.cmdOpen.Caption = "Installation" End If End Sub In the form's Current event use: Sub Form_Current() chkWhatever_AfterUpdate End Sub And in the button's click event: Sub cmdOpen_Click() If Me.chkWhatever = True Then DoCmd.OpenForm "ServiceCall" Else DoCmd.OpenForm "Installation" End If End Sub -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "GeoffK" wrote in message ... Hi All, I have 3 forms "DailyRoute", "ServiceCall" and "Installation". "ServiceCall" and "Installation" have control source as "TblCustomers" when the customer details are entered a checkbox is check to identify a Service Call, the issue is that different information is required for each job type ("ServiceCall" or "Installation") therefore I require 2 forms for closing the days work. Is it possible to click the "update" command button in "DailyRoute" and display either "ServiceCall" or "Installation" forms depending on the checked box. Thanking you in advance GeoffK |
#3
|
|||
|
|||
command button to open 1 of 2 forms
Arvin,
Thank you for the reply I will try this today. Since posting this thread I have been wondering if it is possible to achieve opening the required form based on data in a within a field. Example : when I enter the customers details into form "Customers_Create" (control source is "TblCustomers") I select a work task from a drop down list. The question is when the "update" command button in "DailyRoute" is pressed can the required form be opened using the selection from the drop down. Thanks again for your reply GeoffK "Arvin Meyer [MVP]" wrote: Sure, you can even change the button caption and what happens in the click event based upon the check box. Use the AfterUpdate event of the check box to change the caption. the use the form's Current event to call it between records. Sub chkWhatever_AfterUpdate() If Me.chkWhatever = True Then Me.cmdOpen.Caption = "ServiceCall" Else Me.cmdOpen.Caption = "Installation" End If End Sub In the form's Current event use: Sub Form_Current() chkWhatever_AfterUpdate End Sub And in the button's click event: Sub cmdOpen_Click() If Me.chkWhatever = True Then DoCmd.OpenForm "ServiceCall" Else DoCmd.OpenForm "Installation" End If End Sub -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "GeoffK" wrote in message ... Hi All, I have 3 forms "DailyRoute", "ServiceCall" and "Installation". "ServiceCall" and "Installation" have control source as "TblCustomers" when the customer details are entered a checkbox is check to identify a Service Call, the issue is that different information is required for each job type ("ServiceCall" or "Installation") therefore I require 2 forms for closing the days work. Is it possible to click the "update" command button in "DailyRoute" and display either "ServiceCall" or "Installation" forms depending on the checked box. Thanking you in advance GeoffK . |
#4
|
|||
|
|||
command button to open 1 of 2 forms
Arvin,
I have been trying to get your suggestion to work but get compile errors I think this may be because I am using this on 2 different forms and your code is for 1 form. ("Customer_Create" to input the customers details including the checkbox and "Daily_Route" to select the required customer then press command "update" to take me to the appropriate Customer) "Arvin Meyer [MVP]" wrote: Sure, you can even change the button caption and what happens in the click event based upon the check box. Use the AfterUpdate event of the check box to change the caption. the use the form's Current event to call it between records. Sub chkWhatever_AfterUpdate() If Me.chkWhatever = True Then Me.cmdOpen.Caption = "ServiceCall" Else Me.cmdOpen.Caption = "Installation" End If End Sub In the form's Current event use: Sub Form_Current() chkWhatever_AfterUpdate End Sub And in the button's click event: Sub cmdOpen_Click() If Me.chkWhatever = True Then DoCmd.OpenForm "ServiceCall" Else DoCmd.OpenForm "Installation" End If End Sub -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "GeoffK" wrote in message ... Hi All, I have 3 forms "DailyRoute", "ServiceCall" and "Installation". "ServiceCall" and "Installation" have control source as "TblCustomers" when the customer details are entered a checkbox is check to identify a Service Call, the issue is that different information is required for each job type ("ServiceCall" or "Installation") therefore I require 2 forms for closing the days work. Is it possible to click the "update" command button in "DailyRoute" and display either "ServiceCall" or "Installation" forms depending on the checked box. Thanking you in advance GeoffK . |
#5
|
|||
|
|||
command button to open 1 of 2 forms
Post the code you are using in each form.
-- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "GeoffK" wrote in message ... Arvin, I have been trying to get your suggestion to work but get compile errors I think this may be because I am using this on 2 different forms and your code is for 1 form. ("Customer_Create" to input the customers details including the checkbox and "Daily_Route" to select the required customer then press command "update" to take me to the appropriate Customer) "Arvin Meyer [MVP]" wrote: Sure, you can even change the button caption and what happens in the click event based upon the check box. Use the AfterUpdate event of the check box to change the caption. the use the form's Current event to call it between records. Sub chkWhatever_AfterUpdate() If Me.chkWhatever = True Then Me.cmdOpen.Caption = "ServiceCall" Else Me.cmdOpen.Caption = "Installation" End If End Sub In the form's Current event use: Sub Form_Current() chkWhatever_AfterUpdate End Sub And in the button's click event: Sub cmdOpen_Click() If Me.chkWhatever = True Then DoCmd.OpenForm "ServiceCall" Else DoCmd.OpenForm "Installation" End If End Sub -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "GeoffK" wrote in message ... Hi All, I have 3 forms "DailyRoute", "ServiceCall" and "Installation". "ServiceCall" and "Installation" have control source as "TblCustomers" when the customer details are entered a checkbox is check to identify a Service Call, the issue is that different information is required for each job type ("ServiceCall" or "Installation") therefore I require 2 forms for closing the days work. Is it possible to click the "update" command button in "DailyRoute" and display either "ServiceCall" or "Installation" forms depending on the checked box. Thanking you in advance GeoffK . |
#6
|
|||
|
|||
command button to open 1 of 2 forms
Arvin,
The code below is for the command button (on form "Daily_Route") that when clicked it would open either "Input" (installations) or "Service_Call" depending on the checkbox or preferably on the work task selected. Private Sub Update_Click() On Error GoTo Err_Update_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "Input" stLinkCriteria = "[JobNo]=" & "'" & Me![JobNo] & "'" DoCmd.OpenForm stDocName, , , stLinkCriteria If Me.Service_Call = True Then DoCmd.OpenForm "ServiceCall" Else DoCmd.OpenForm "Installation" End If Exit_Update_Click: Exit Sub Err_Update_Click: MsgBox Err.Description Resume Exit_Update_Click End Sub The checkBox Service_Call on form "Customer_Create" Private Sub Service_Call_AfterUpdate() If Me.Service_Call = True Then Me.cmdOpen.Caption = "ServiceCall" Else Me.cmdOpen.Caption = "Installation" End If End Sub Thanking You in advance GeoffK "Arvin Meyer [MVP]" wrote: Post the code you are using in each form. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "GeoffK" wrote in message ... Arvin, I have been trying to get your suggestion to work but get compile errors I think this may be because I am using this on 2 different forms and your code is for 1 form. ("Customer_Create" to input the customers details including the checkbox and "Daily_Route" to select the required customer then press command "update" to take me to the appropriate Customer) "Arvin Meyer [MVP]" wrote: Sure, you can even change the button caption and what happens in the click event based upon the check box. Use the AfterUpdate event of the check box to change the caption. the use the form's Current event to call it between records. Sub chkWhatever_AfterUpdate() If Me.chkWhatever = True Then Me.cmdOpen.Caption = "ServiceCall" Else Me.cmdOpen.Caption = "Installation" End If End Sub In the form's Current event use: Sub Form_Current() chkWhatever_AfterUpdate End Sub And in the button's click event: Sub cmdOpen_Click() If Me.chkWhatever = True Then DoCmd.OpenForm "ServiceCall" Else DoCmd.OpenForm "Installation" End If End Sub -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "GeoffK" wrote in message ... Hi All, I have 3 forms "DailyRoute", "ServiceCall" and "Installation". "ServiceCall" and "Installation" have control source as "TblCustomers" when the customer details are entered a checkbox is check to identify a Service Call, the issue is that different information is required for each job type ("ServiceCall" or "Installation") therefore I require 2 forms for closing the days work. Is it possible to click the "update" command button in "DailyRoute" and display either "ServiceCall" or "Installation" forms depending on the checked box. Thanking you in advance GeoffK . . |
#7
|
|||
|
|||
command button to open 1 of 2 forms
That code should compile without any errors. It should also run without
error assuming you got the names of everything right. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "GeoffK" wrote in message ... Arvin, The code below is for the command button (on form "Daily_Route") that when clicked it would open either "Input" (installations) or "Service_Call" depending on the checkbox or preferably on the work task selected. Private Sub Update_Click() On Error GoTo Err_Update_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "Input" stLinkCriteria = "[JobNo]=" & "'" & Me![JobNo] & "'" DoCmd.OpenForm stDocName, , , stLinkCriteria If Me.Service_Call = True Then DoCmd.OpenForm "ServiceCall" Else DoCmd.OpenForm "Installation" End If Exit_Update_Click: Exit Sub Err_Update_Click: MsgBox Err.Description Resume Exit_Update_Click End Sub The checkBox Service_Call on form "Customer_Create" Private Sub Service_Call_AfterUpdate() If Me.Service_Call = True Then Me.cmdOpen.Caption = "ServiceCall" Else Me.cmdOpen.Caption = "Installation" End If End Sub Thanking You in advance GeoffK "Arvin Meyer [MVP]" wrote: Post the code you are using in each form. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "GeoffK" wrote in message ... Arvin, I have been trying to get your suggestion to work but get compile errors I think this may be because I am using this on 2 different forms and your code is for 1 form. ("Customer_Create" to input the customers details including the checkbox and "Daily_Route" to select the required customer then press command "update" to take me to the appropriate Customer) "Arvin Meyer [MVP]" wrote: Sure, you can even change the button caption and what happens in the click event based upon the check box. Use the AfterUpdate event of the check box to change the caption. the use the form's Current event to call it between records. Sub chkWhatever_AfterUpdate() If Me.chkWhatever = True Then Me.cmdOpen.Caption = "ServiceCall" Else Me.cmdOpen.Caption = "Installation" End If End Sub In the form's Current event use: Sub Form_Current() chkWhatever_AfterUpdate End Sub And in the button's click event: Sub cmdOpen_Click() If Me.chkWhatever = True Then DoCmd.OpenForm "ServiceCall" Else DoCmd.OpenForm "Installation" End If End Sub -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.mvps.org/access http://www.accessmvp.com "GeoffK" wrote in message ... Hi All, I have 3 forms "DailyRoute", "ServiceCall" and "Installation". "ServiceCall" and "Installation" have control source as "TblCustomers" when the customer details are entered a checkbox is check to identify a Service Call, the issue is that different information is required for each job type ("ServiceCall" or "Installation") therefore I require 2 forms for closing the days work. Is it possible to click the "update" command button in "DailyRoute" and display either "ServiceCall" or "Installation" forms depending on the checked box. Thanking you in advance GeoffK . . |
Thread Tools | |
Display Modes | |
|
|