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  

Changing title on form based on what is filtered



 
 
Thread Tools Display Modes
  #1  
Old January 5th, 2008, 11:49 PM posted to microsoft.public.access.forms
tsison7
external usenet poster
 
Posts: 69
Default Changing title on form based on what is filtered

I have a form where the title can be either "Delivery Reports: Customers X"
or "Delivery Reports: Customers Y".

When a command button is pressed I set a variable "customer" to 1 for
Customers X and to 2 for Customers Y depending on which command button is
pressed.

Since the forms are identical I want to use the same form but have the title
change depending on which Customers X or Y it is for.

I've set the title to "=iif(customer =1,"Delivery Reports: Customers
X","Delivery Reports: Customers Y))". But all it shows up with is "Name?"

I also had to define "customer" as a Public Variable.

I can get it to work using a function like:

Public Function getmyvariablecustomer() As String
getmyvariabletitle = customer
End Function

and rewriting the statement as =iif(getmyvariablecustomer()=1,.....)

But that seems like the wrong way to go about it....is it?
--
TIA
  #2  
Old January 6th, 2008, 01:22 AM posted to microsoft.public.access.forms
Al Campagna[_2_]
external usenet poster
 
Posts: 1,462
Default Changing title on form based on what is filtered

tsison7,
I think there's a much easier way to change a title (TextControl) on on a
form according to how it was opened.
Use the OpenArgs portion of the OpenForm Method.
Use
=[OpenArgs ]
as the ControlSource of your Title field.

Use 2 different OpenForm methods to open each form
DoCmd.OpenForm "frmYourFormX", , , , , , "Customer X"
and
DoCmd.OpenForm "frmYourForm", , , , , , "Customer Y"
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


"tsison7" wrote in message
...
I have a form where the title can be either "Delivery Reports: Customers X"
or "Delivery Reports: Customers Y".

When a command button is pressed I set a variable "customer" to 1 for
Customers X and to 2 for Customers Y depending on which command button is
pressed.

Since the forms are identical I want to use the same form but have the
title
change depending on which Customers X or Y it is for.

I've set the title to "=iif(customer =1,"Delivery Reports: Customers
X","Delivery Reports: Customers Y))". But all it shows up with is "Name?"

I also had to define "customer" as a Public Variable.

I can get it to work using a function like:

Public Function getmyvariablecustomer() As String
getmyvariabletitle = customer
End Function

and rewriting the statement as =iif(getmyvariablecustomer()=1,.....)

But that seems like the wrong way to go about it....is it?
--
TIA



  #3  
Old January 7th, 2008, 07:04 PM posted to microsoft.public.access.forms
tsison7
external usenet poster
 
Posts: 69
Default Changing title on form based on what is filtered

Thanks, Al very helpful
--
TIA


"Al Campagna" wrote:

tsison7,
I think there's a much easier way to change a title (TextControl) on on a
form according to how it was opened.
Use the OpenArgs portion of the OpenForm Method.
Use
=[OpenArgs ]
as the ControlSource of your Title field.

Use 2 different OpenForm methods to open each form
DoCmd.OpenForm "frmYourFormX", , , , , , "Customer X"
and
DoCmd.OpenForm "frmYourForm", , , , , , "Customer Y"
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."


"tsison7" wrote in message
...
I have a form where the title can be either "Delivery Reports: Customers X"
or "Delivery Reports: Customers Y".

When a command button is pressed I set a variable "customer" to 1 for
Customers X and to 2 for Customers Y depending on which command button is
pressed.

Since the forms are identical I want to use the same form but have the
title
change depending on which Customers X or Y it is for.

I've set the title to "=iif(customer =1,"Delivery Reports: Customers
X","Delivery Reports: Customers Y))". But all it shows up with is "Name?"

I also had to define "customer" as a Public Variable.

I can get it to work using a function like:

Public Function getmyvariablecustomer() As String
getmyvariabletitle = customer
End Function

and rewriting the statement as =iif(getmyvariablecustomer()=1,.....)

But that seems like the wrong way to go about it....is it?
--
TIA




 




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 08:36 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.