Hello everyone
Am using a For Loop to access records from my database but the code opens instead of a specific record base on values passed by the user. These values a fields in the database which i want to make keys.
This a bit of the code
Vb 6 and Microsof Access
code Vb:
If rs.RecordCount = 0 Then Exit Sub
rs.MoveFirst
For i = 1 To rs.RecordCount ' Read all the records from database
cbosch = rs("CentNo")
Cand_No = rs("IndexNo")
Sex = rs("Sex")
DOB = rs("DOB")
Cnd_Name = rs("CandName")
Grd11 = rs("Grd1")
Subj2 = rs("Subj2")
Grd12 = rs("Grd2")
Subj3 = rs("Subj3")
Grd13 = rs("Grd3")
Subj4 = rs("Subj4")
Grd14 = rs("Grd4")
Subj5 = rs("Subj5")
Grd15 = rs("Grd5")
Subj6 = rs("Subj6")
Grd16 = rs("Grd6")
Subj7 = rs("Subj7")
Grd17 = rs("Grd7")
Subj8 = rs("Subj8")
Grd18 = rs("Grd8")
'validate the Key fields (Examseries, year, candNo and index no.)
Exam_Sr = rs("ExamSeries" )
If Exam_Sr = "" Then
MsgBox ("Pls enter the correct Exam Serie"), vbOKOnly
ElseIf Exam_Sr = 1 Then
frmListing.Exam _Series.Caption = "May/June"
Else
Exam_Sr = 2
frmListing.Exam _Series.Caption = "Nov/Dec"
Me.Exam_Sr.SetF ocus
Me.Refresh
End If
Exam_Yr = rs("ExamYear")
If Exam_Yr = "" Then
MsgBox ("Please Enter the exam year"), vbOKOnly
Me.Exam_Yr.SetF ocus
End If
It prints the fields on to another form after getting them
'Show a modal form named frmListing.
frmListing.Show vbModal, Me
rs.MoveNext
Next i
code ends
Am using a For Loop to access records from my database but the code opens instead of a specific record base on values passed by the user. These values a fields in the database which i want to make keys.
This a bit of the code
Vb 6 and Microsof Access
code Vb:
If rs.RecordCount = 0 Then Exit Sub
rs.MoveFirst
For i = 1 To rs.RecordCount ' Read all the records from database
cbosch = rs("CentNo")
Cand_No = rs("IndexNo")
Sex = rs("Sex")
DOB = rs("DOB")
Cnd_Name = rs("CandName")
Grd11 = rs("Grd1")
Subj2 = rs("Subj2")
Grd12 = rs("Grd2")
Subj3 = rs("Subj3")
Grd13 = rs("Grd3")
Subj4 = rs("Subj4")
Grd14 = rs("Grd4")
Subj5 = rs("Subj5")
Grd15 = rs("Grd5")
Subj6 = rs("Subj6")
Grd16 = rs("Grd6")
Subj7 = rs("Subj7")
Grd17 = rs("Grd7")
Subj8 = rs("Subj8")
Grd18 = rs("Grd8")
'validate the Key fields (Examseries, year, candNo and index no.)
Exam_Sr = rs("ExamSeries" )
If Exam_Sr = "" Then
MsgBox ("Pls enter the correct Exam Serie"), vbOKOnly
ElseIf Exam_Sr = 1 Then
frmListing.Exam _Series.Caption = "May/June"
Else
Exam_Sr = 2
frmListing.Exam _Series.Caption = "Nov/Dec"
Me.Exam_Sr.SetF ocus
Me.Refresh
End If
Exam_Yr = rs("ExamYear")
If Exam_Yr = "" Then
MsgBox ("Please Enter the exam year"), vbOKOnly
Me.Exam_Yr.SetF ocus
End If
It prints the fields on to another form after getting them
'Show a modal form named frmListing.
frmListing.Show vbModal, Me
rs.MoveNext
Next i
code ends
Comment