A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

command button to open 1 of 2 forms



 
 
Thread Tools Display Modes
  #1  
Old January 19th, 2010, 06:11 AM posted to microsoft.public.access.forms
GeoffK
external usenet poster
 
Posts: 12
Default 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  
Old January 19th, 2010, 06:29 AM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default 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  
Old January 31st, 2010, 01:14 AM posted to microsoft.public.access.forms
GeoffK
external usenet poster
 
Posts: 12
Default 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  
Old January 31st, 2010, 01:43 AM posted to microsoft.public.access.forms
GeoffK
external usenet poster
 
Posts: 12
Default 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  
Old January 31st, 2010, 02:50 AM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default 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  
Old February 1st, 2010, 02:49 AM posted to microsoft.public.access.forms
GeoffK
external usenet poster
 
Posts: 12
Default 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  
Old February 1st, 2010, 05:13 AM posted to microsoft.public.access.forms
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:24 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.