changing form caption on loop

jasn_78

Registered User.
Local time
Tomorrow, 08:37
Joined
Aug 1, 2001
Messages
214
hey guys I have a form frmComparison with caption header to start with of the below code

Code:
Dim P As Integer

P = 1

Me.Caption = "SALES COMPARISON PERIOD" & P

i have a button on that form that closes and reopens that form called cmdNEXT

what i want to happen is each time that next button is clicked the caption changes from 1 to 2 etc
 
i have a button on that form that closes and reopens that form called cmdNEXT

what i want to happen is each time that next button is clicked the caption changes from 1 to 2 etc
Jason,

You can either use the Right() function to extract the last letter in the caption, or just set a global variable that changes on every click of the button when you assign it a new value. In other words, for the variable, the code would be (on each click of the button):
Code:
variable name = variable name + 1

  me.caption = "SALES COMPARISON PERIOD" & variable name
 
so aje that will work even though i am closing the form after each time?
 
Yes. As long as you save the form. If you don't save it, the caption will not be saved. Use docmd.save

you will have to modify the code a bit, but the basic idea is here...
 

Attachments

thanks adam,

any idea how i would then for that same form which has text boxes and comboboxes. record each list of options for different comparison periods?
 
Record? As in, copy to a table and store the data? Not sure. There are a number of ways to do that, but your request is a bit vague (sorry to say). =)
 
sorry adam meant Record (like record a movie) :) as in store my filter options for each period.
 
Jason,

I would just make a seperate table to store this data in. Like, one record for the data displayed under Caption 1, then another record for Caption 2, etc...

Just copy the data that is in the controls to a table via some code before you close the form and open it again...
 
adam are you saying store the filters in a table or are you saying store each set of results in a table???
 
A filter IS a set of results. You can only see one record at a time on your form, correct? If that is so, then I am telling you to store each set of results in a table. Is that not what you want?
 

Users who are viewing this thread

Back
Top Bottom