How do you skip a value if there is a condition in a for loop?
for i = 0 to 8
if i = 8 then
move next (else it is at the end)
end if
next
How do you skip a value if there is a condition in a for loop?
for i = 0 to 8
if i = 8 then
move next (else it is at the end)
end if
next
I don't understand. Why do you need to test for 8?
Move to Next what?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
I have a combo box that I want to loop through until all rows in the combo box are cycled through
however if one of the rows happens to have an id of say 8 - I want it to move on and not do the task for that row.
problem also is that the row might be the final row so there wouldn't be anything to go next to... so I can't i = i + 1
at the moment I can do this
Function makeHTMLPDF(controlYear As Control, controlType As Control, controlState As Control, controlArea As Control, frm1 As String)
For i = 0 To controlState.ListCount
controlState = controlState.Column(0, i)
If controlState.Column(0) <> 8 Then
Debug.Print controlState.Column(1) & " keep "
End If
Next
however I would prefer to skip if the value is 8
Then I believe you are doing what must be done. Test if i is 8 and if it is, bypass code.
Why are you picking on 8? What if the value of controlState is 21?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
8 is a state that it skips as it has no records related to it (it's complicated)
the code works fine thanks - however it relates to this problem
https://www.accessforums.net/reports...ted-45495.html
I still can't solve this one and it has to do with the report
Can't solve what? That other thread says you fixed the issue.
I've never seen code that loops through combobox rows.
Also, why use a Function procedure if the function does not return a value? It's really a Sub procedure.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Yeah, I fixed it after some time after I posted the link.
I found it easy to loop through combo boxes - it saves me having to make queries or sql strings and I can make it user customisable in the sense that they can choose what position they want to execute the code from when using the combo boxes.
Yeah I probably should rename that function to a sub in the module...
Might also say this database (one of two I work on) builds the company website to file. So the staff maintain the tour schedule through a front end and I update the server with the ready made html files made from the database.
It's no Ruby on Rails (I'm using Access to build a website) but it's a quick solution for now and it works well there is a lot of information to have to put on the website and this database automates most of it
I know there is PHP and SQL etc but I don't want to go down that track with this at the moment.