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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|