If statement (1 Viewer)

taniadimitri

Registered User.
Local time
Yesterday, 23:29
Joined
Mar 13, 2007
Messages
17
I have a form with 9 tabs. Each tab has a multiple questions and drop downs. I was trying to add new questions to a tab. Below is the code for it.

code:

For x = 1 To TotQues
Form("Drop" & x).Visible = False
Form("Drop" & x).TabStop = False
Form("Q" & x).value = Null
Form("Pt" & x).Visible = False
Next x

Set rstlog = dbslog.OpenRecordset(sSql, dbOpenSnapshot)

With rstlog
For i = 1 To TotQues
If rstlog.EOF Then
For x = i To TotQues
Form("Drop" & x).Visible = False
Form("Drop" & x).TabStop = False
Form("Q" & x).value = Null
Next x
Exit For
End If
If (i >= 1 And i <= 8 And !SecTitle = "Appraiser") Or _
(i >= 9 And i <= 16 And !SecTitle = "Subject") Or _
(i >= 17 And i <= 24 And !SecTitle = "Neighborhood") Or _
(i >= 25 And i <= 32 And !SecTitle = "Site") Or _
(i >= 33 And i <= 44 And !SecTitle = "Improvements") Or _
(i >= 45 And i <= 70 And !SecTitle = "Sales Comparison") Or _
(i >= 71 And i <= 78 And !SecTitle = "Value") Or _
(i >= 79 And i <= 86 And !SecTitle = "Addendum") Or _
(i >= 87 And i <= 102 And !SecTitle = "Other") Or _
(i >= 103 And i <= 104 And !SecTitle = "Site") Then (This is the one I added newly)
Form("Q" & i).value = !Question
row = "SELECT ComboList FROM tbl_app_rev_combo where ComboNum = '" & !Combo & "' ORDER BY SrtOrd"
Form("Combo_Option" & i).value = !Combo
Form("drop" & i).RowSource = row
Form("drop" & i) = !Default
Form("Drop" & i).Visible = True
Form("Drop" & i).TabStop = True
Form("Pt" & i).Visible = True
Form("Pt" & i) = !DefaultPts
.MoveNext
Else
Form("Drop" & i).Visible = False
Form("Drop" & i).TabStop = False
Form("Pt" & i).Visible = False
End If
Next i
End With

My issue is I am able to see the Questions untill "Site" tab. The questions after this tab have disappeared. This is because after i = 104 it is not going back to i = 33 and so all the questions in other tabs are gone. Is there any solution for this. How do I get get back the questions in other tabs?

I am attaching the screen shot of "site" tab and "improvements tab whic is next to the site tab.

Thanks,
 

Attachments

  • screen2.GIF
    screen2.GIF
    33.6 KB · Views: 108
  • screen1.JPG
    screen1.JPG
    76.1 KB · Views: 122

boblarson

Smeghead
Local time
Yesterday, 23:29
Joined
Jan 12, 2001
Messages
32,059
Are you trying to say that the ANSWERS to the questions have disappeared? Because it looks to me, from your screen shots, that the questions are still there, but the answers are not there.
 

taniadimitri

Registered User.
Local time
Yesterday, 23:29
Joined
Mar 13, 2007
Messages
17
Actually if you observe the screen shots you will see questions and default values in the drop downs in "site" tab. But if you look at the "improvements" tab (second scree shot) you don't see any questions. The questions in that tab starts from i=33. As the questions in site tab starts from i=24 to i=32 and again i=103 t0 104 the loop is not going back from i=104 to i=33. I am not sure how to rewrite the code to go back to i=33. Do you have any suggestions?

Thanks,
 

WayneRyan

AWF VIP
Local time
Today, 07:29
Joined
Nov 19, 2002
Messages
7,122
T,

(i >= 103 And i <= 104 And !SecTitle = "Site")

It doesn't seem that i will ever be >= 103 AND <= 104

at least if it's an integer. 103.5 maybe.

hth,
Wayne
 

Bat17

Registered User.
Local time
Today, 07:29
Joined
Sep 24, 2004
Messages
1,687
looks to me as if 103 and 104 both qualify :)

have you upped TotQues in
For x = 1 To TotQues

to reach 104?

Peter
 

WayneRyan

AWF VIP
Local time
Today, 07:29
Joined
Nov 19, 2002
Messages
7,122
Bat,

Nice recatch !

I thought I'd found the "easy" solution. Guess that's why I don't work on weekends.

Wayne
 

Users who are viewing this thread

Top Bottom