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??
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??