![]() |
buttons on forms
Probably something really simple but.....
I am using a form to display questions and ask for responses ("true" & "false" on command buttons). the form initiallises ok and the first question is displayed (populating a label(caption)using offset and related to a worksheet "questions" where the questions are in a column) The sub for the "True" button includes a call to a public sub in a module which has the following: ------------------------------------------------------------------------------------------------ y = y + 1 x = x + 1 form.Caption = "Question " & x q = ActiveCell.Offset(x, 0).Text form!question.Caption = q form!Label1.Caption = x 'test for increase in variabl ------------------------------------------------------------------------------------------------ x is set to 1 on 'workbook open' and is used to offset for the questions and number the form The problem is that the command button only works once and the variable 'x' does not increase when "true" is hit (i.e. it stays at 1) How do i reset it please? -- Jabba -- Jabba |
buttons on forms
Jabba,
Try declaring the variable X in the General Declarations portion of your public module. Like this: Public X As Integer That should be all that is necessary, leaving your existing code for X in place. -Jack "Jabba" wrote: Probably something really simple but..... I am using a form to display questions and ask for responses ("true" & "false" on command buttons). the form initiallises ok and the first question is displayed (populating a label(caption)using offset and related to a worksheet "questions" where the questions are in a column) The sub for the "True" button includes a call to a public sub in a module which has the following: ------------------------------------------------------------------------------------------------ y = y + 1 x = x + 1 form.Caption = "Question " & x q = ActiveCell.Offset(x, 0).Text form!question.Caption = q form!Label1.Caption = x 'test for increase in variable ------------------------------------------------------------------------------------------------ x is set to 1 on 'workbook open' and is used to offset for the questions and number the form The problem is that the command button only works once and the variable 'x' does not increase when "true" is hit (i.e. it stays at 1) How do i reset it please? -- Jabba -- Jabba |
All times are GMT +1. The time now is 12:41 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com