Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help incrementing a number by 1 3

Status
Not open for further replies.

kat17

Technical User
Aug 21, 2005
17
AU
I have a table called tblStudent & a matching form with the following fields:
idClass(Long), idSchool(String), rollNo(Long), barcode(String), fName(String), lName(String)

I would like to increment the field "rollNo" by 1 depending on a WHERE clause.

My problem is getting my form to work properly.
How do you insert SQL & variables into Visual Basic syntax?

This is my attempt.. but its not working!


SQL = "SELECT Last(tblStudent.rollNo)" & _
" FROM tblClass INNER JOIN tblStudent ON tblClass.idClass = tblStudent.idClass" & _
" GROUP BY tblClass.rowClass, tblStudent.idSchool" & _
" HAVING (((tblClass.rowClass)=" & Me.Combo8.Value & _
") AND ((tblStudent.idSchool)='" & Trim$(Me.Combo10.Value) & _
"'))"

I'm only new to Visual Basic but have used other programming languages before. I'm not sure how I have to go about declaring this statement and where should I put it??

I've seen on the net somewhere to use the trim() function to help with reading the String properly. Now I'm just lost and dont know what to do!!
Is there a simpler solution??
 
Now I could say I learned more from this thread than kat17
Thanks earthandfire

________________________________________________________________________
Zameer Abdulla
Visit Me
Children are poor men's riches.
 
Well I've picked up more than enough tips from you over the last few months, Zameer, so you are very welcome.
 
[2thumbsup]

________________________________________________________________________
Zameer Abdulla
Visit Me
A person who misses a chance and the monkey who misses its branch can't be saved.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top