By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,234 Members | 1,823 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,234 IT Pros & Developers. It's quick & easy.

increasing a declared integer by in a loop

P: 2
in this case I have set up a recordset correctly, and I am trying to increase directno by 1 each time.
I thought simply directno= directno + 1 would work but it doesn't.
I have now tried this function - but again I can't get an increase past 1.
the message box is just to see whats going on.

Probably I am being silly but where am I going wrong please?? Any tips gratefully received

Dim directno as Integer
directno=0
With rstSupply
If Not .EOF Then
.MoveFirst
End If
Do Until .EOF
If !supplyTypeID = 1 Then
directno = inc(directno)
MsgBox (directno)
End If
.MoveNext
Loop
End With
rstSupply.Close
........
Function inc(ByRef data As Integer)
data = data + 1
inc = data
End Function
Dec 30 '17 #1
Share this Question
Share on Google+
1 Reply


P: 2
Sorry everybody. The reason it didn't work was because I didnt put square brackets around the field. It was a false alarm

![transTypeID]- nothing to do with increasing the number
Dec 30 '17 #2

Post your reply

Sign in to post your reply or Sign up for a free account.