Please help me... Its very urgent... I've to finish my miniproject by tomorrow...
Please Debug The coding given below... i am doin student information system. in vb oracle.
i have created a module in which i wanna display info about students extracurriculars in ms flex grid control from a form in which i have twenty choices of extracurriculars displayed in check box. no i don know how to display the info in ms flex grid. the cheked extracurriculars shud be displyed in the grid... help me.. plz debug and send reply...
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim a, b, c As Integer
'Dim yoga, karathe, ncc, nss, cricket, football, volleyball, basketball, chess, tennis, snooker, tabletennis, dance, singing, instrument, artwork, drama, monoact, painting, sketching As integer
Private Sub Command1_Click()
Text1.SetFocus
If yoga.Value = 1 Then
yoga = 1
Else
yoga = 0
End If
If (karathe.Value = 1) Then
karathe = 1
Else
karathe = 0
End If
If (ncc.Value = 1) Then
ncc = 1
Else
ncc = 0
End If
If (nss.Value = 1) Then
nss = 1
Else
nss = 0
End If
If (cricket.Value = 1) Then
cricket = 1
Else
cricket = 0
End If
If (football.Value = 1) Then
football = 1
Else
football = 0
End If
If (volleyball.Value = 1) Then
volleyball = 1
Else
volleyball = 0
End If
If (basketball.Value = 1) Then
basketball = 1
Else
basketball = 0
End If
If (chess.Value = 1) Then
chess = 1
Else
chess = 0
End If
If (tennis.Value = 1) Then
tennis = 1
Else
tennis = 0
End If
If (snooker.Value = 1) Then
snooker = 1
Else
snooker = 0
End If
If (tabletennis.Value = 1) Then
tabletennis = 1
Else
tabletennis = 0
End If
If (dance.Value = 1) Then
dance = 1
Else
dance = 0
End If
If (singing.Value = 1) Then
singing = 1
Else
singing = 0
End If
If (instrument.Value = 1) Then
instrument = 1
Else
instrument = 0
End If
If (artwork.Value = 1) Then
artwork = 1
Else
artwork = 0
End If
If (drama.Value = 1) Then
drama = 1
Else
drama = 0
End If
If (monoact.Value = 1) Then
monoact = 1
Else
monoact = 0
End If
If (painting.Value = 1) Then
painting = 1
Else
painting = 0
End If
If (sketching.Value = 1) Then
sketching = 1
Else
sketching = 0
End If
cmd.CommandText = "insert into extras values('" & Text1.Text & "','" & Text2.Text & "','" & Text3.Text & "'," & Text4.Text & ",'" & yoga & "','" & karathe & "','" & ncc & "','" & nss & "','" & cricket & "','" & football & "','" & volleyball & "','" & basketball & "','" & chess & "','" & tennis & "','" & snooker & "','" & tabletennis & "','" & dance & "','" & singing & "','" & instrument & "','" & artwork & "','" & drama & "','" & monoact & "','" & painting & "','" & sketching & "')"
cmd.Execute
MsgBox "Record Saved"
clear
End Sub
Private Sub Command10_Click()
rs.MovePrevious
If (rs.BOF) Then
rs.MoveFirst
MsgBox "No More Moves."
Else
display
End If
End Sub
Private Sub Command11_Click()
rs.MoveNext
If (rs.EOF) Then
rs.MoveLast
MsgBox "No More Moves."
Else
display
End If
End Sub
Private Sub Command12_Click()
rs.MoveLast
display
End Sub
Private Sub Command5_Click()
Dim X As Variant
clear
rs.Requery
X = InputBox("Enter the reg / roll no of the student : ")
rs.Find "rollno=" & X, 0, adSearchBackward
If (rs.EOF <> 1) Then
Text1.Text = rs(0)
Text2.Text = rs(1)
Text3.Text = rs(2)
Text4.Text = rs(3)
yoga = rs(4)
karathe = rs(5)
ncc = rs(6)
nss = rs(7)
cricket = rs(8)
football = rs(9)
volleyball = rs(10)
basketball = rs(11)
chess = rs(12)
tennis = rs(13)
snooker = rs(14)
tabletennis = rs(15)
dance = rs(16)
singing = rs(17)
instrument = rs(18)
artwork = rs(19)
drama = rs(20)
monoact = rs(21)
painting = rs(22)
sketching = rs(23)
Else
MsgBox " The Record was not found."
End If
End Sub
Private Sub Command2_Click()
message = "The Record was updated."
Title = "Update"
Response = MsgBox(message, dialog, Title)
If Response = vbYes Then
cmd.CommandText = "update extras set karathe = rollno='" & Text1.Text & "', stuname='" & Text2.Text & "', class='" & Text3.Text & "', yrad=" & Text4.Text & "',yoga='" & yoga & "', KARATHE = '" & karathe & "', NCC = '" & ncc & "', NSS = '" & nss & "', cricket = '" & cricket & "', football = '" & football & "', volleyball = '" & volleyball & "', BASKETBALL = '" & basketball & "', chess = '" & chess & "', TENNIS = '" & tennis & "', SNOOKER = '" & snooker & "', TABLETENNIS = '" & tabletennis & "', DANCE = '" & dance & "', singing = '" & singing & "', INSTRUMENT = '" & instrument & "', ARTWORK = '" & artwork & "', DRAMA = '" & drama & "', MONOACT = '" & monoact & "', PAINTING = '" & painting & "', SKETCHING = '" & sketching & "'"
cmd.Execute
clear
End If
End Sub
Private Sub Command3_Click()
cmd.CommandText = "delete extras where rollno = '" & Text1.Text & "'"
cmd.Execute
MsgBox " The Record was Deleted."
clear
End Sub
Private Sub display()
On Error GoTo label
Text1.Text = rs(0)
Text2.Text = rs(1)
Text3.Text = rs(2)
Text4.Text = rs(3)
yoga = Val(rs(4))
karathe = Val(rs(5))
ncc = Val(rs(6))
nss = Val(rs(7))
cricket = Val(rs(8))
football = Val(rs(9))
volleyball = Val(rs(10))
basketball = Val(rs(11))
chess = Val(rs(12))
tennis = Val(rs(13))
snooker = Val(rs(14))
tabletennis = Val(rs(15))
dance = Val(rs(16))
singing = Val(rs(17))
instrument = Val(rs(18))
artwork = Val(rs(19))
drama = Val(rs(20))
monoact = Val(rs(21))
painting = Val(rs(22))
sketching = Val(rs(23))
label:
If Err.Number = 3265 Then
End If
End Sub
Private Sub Command4_Click()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
yoga = " "
karathe = " "
ncc = " "
nss = " "
cricket = " "
football = " "
volleyball = " "
basketball = " "
chess = " "
tennis = " "
snooker = " "
tabletennis = " "
dance = " "
singing = " "
instrument = " "
artwork = " "
drama = " "
monoact = " "
painting = " "
sketching = " "
End Sub
Private Sub clear()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
'yoga = " "
'karathe = " "
'ncc = " "
'nss = " "
'cricket = " "
'football = " "
'volleyball = " "
'basketball = " "
'chess= " "
'tennis = " "
'snooker = " "
'tabletennis = " "
'dance = " "
'singing = " "
'instrument = " "
'artwork = " "
'drama = " "
'monoact = " "
'painting = " "
'sketching = " "
End Sub
Private Sub Command6_Click()
PersonalInformationPage.Show
ExtraCurricularsPage.Hide
End Sub
Private Sub Command7_Click()
HomePage.Show
ExtraCurricularsPage.Hide
End Sub
Private Sub Command8_Click()
End
End Sub
Private Sub Command9_Click()
rs.MoveFirst
display
End Sub
Private Sub Form_Load()
Set cn = New ADODB.Connection
cn.Open "Provider=MSDAORA.1;Password=tiger;User ID=scott;Data Source=srm;Persist Security Info=True"
Set rs = New ADODB.Recordset
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic
rs.Open "select * from extras", cn
Set cmd = New ADODB.Command
cmd.ActiveConnection = cn
MsgBox "You have entered into extra curricular activities section"
End Sub
this is the code for saving the check box information.
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cmd As New ADODB.Command
Dim a, b, c As Integer
Private Sub Command1_Click()
Dim searchs As New ADODB.Recordset
MSFlexGrid1.clear
With MSFlexGrid1
.Rows = 1
.Row = 0
.Col = 0
.ColWidth(0) = 1500
.Text = "ROLLNO"
.Col = 1
.ColWidth(1) = 3000
.Text = "NAME"
.Col = 2
.ColWidth(2) = 1500
.Text = "CLASS"
.Col = 3
.ColWidth(3) = 1000
.Text = "YRAD"
.Col = 4
.ColWidth(4) = 600
.Text = "YOGA"
.Col = 5
.ColWidth(5) = 600
.Text = "KARATHE"
.Col = 6
.ColWidth(6) = 800
.Text = "NCC"
.Col = 7
.ColWidth(7) = 1500
.Text = "NSS"
.Col = 8
.ColWidth(8) = 1500
.Text = "CRICKET"
.Col = 9
.ColWidth(9) = 1500
.Text = "FOOT BALL"
.Col = 10
.ColWidth(10) = 1500
.Text = "VOLLEY BALL"
.Col = 11
.ColWidth(11) = 1000
.Text = "BASKET BALL"
.Col = 12
.ColWidth(12) = 800
.Text = "CHESS"
.Col = 13
.ColWidth(13) = 1500
.Text = "TENNIS"
.Col = 14
.ColWidth(14) = 1500
.Text = "SNOOKER"
.Col = 15
.ColWidth(15) = 1500
.Text = "TABLE TENNIS"
.Col = 16
.ColWidth(16) = 2000
.Text = "DANCE"
.Col = 17
.ColWidth(17) = 2000
.Text = "SINGING"
.Col = 18
.ColWidth(18) = 2000
.Text = "INSTRUMENT"
.Col = 19
.ColWidth(19) = 2000
.Text = "ARTWORK"
.Col = 20
.ColWidth(20) = 2000
.Text = "DRAMA"
.Col = 21
.ColWidth(21) = 2000
.Text = "MONOACT"
.Col = 22
.ColWidth(22) = 1000
.Text = "PAINTING"
.Col = 23
.ColWidth(23) = 1000
.Text = "SKETCHING"
.Col = 24
End With
searchs.Open "select * from extras where substr(name,1,1)like '" & Combo1.Text & "'", cn
b = 1
a = 0
Do While Not searchs.EOF
With MSFlexGrid1
a = a + 1
b = b + 1
.Rows = b
.Row = a
.Col = 0
.ColWidth(0) = 1500
.Text = searchs.Fields(0)
.Col = 1
.ColWidth(1) = 3000
.Text = searchs.Fields(1)
.Col = 2
.ColWidth(2) = 1500
.Text = searchs.Fields(2)
.Col = 3
.ColWidth(3) = 1000
.Text = searchs.Fields(3)
.Col = 4
.ColWidth(4) = 600
.Text = searchs.Fields(4)
.Col = 5
.ColWidth(5) = 600
.Text = searchs.Fields(5)
.Col = 6
.ColWidth(6) = 800
.Text = searchs.Fields(6)
.Col = 7
.ColWidth(7) = 1500
.Text = searchs.Fields(7)
.Col = 8
.ColWidth(8) = 1500
.Text = searchs.Fields(8)
.Col = 9
.ColWidth(9) = 1500
.Text = searchs.Fields(9)
.Col = 10
.ColWidth(10) = 1500
.Text = searchs.Fields(10)
.Col = 11
.ColWidth(11) = 1000
.Text = searchs.Fields(11)
.Col = 12
.ColWidth(12) = 800
.Text = searchs.Fields(12)
.Col = 13
.ColWidth(13) = 1500
.Text = searchs.Fields(13)
.Col = 14
.ColWidth(14) = 1500
.Text = searchs.Fields(14)
.Col = 15
.ColWidth(15) = 1500
.Text = searchs.Fields(15)
.Col = 16
.ColWidth(16) = 2000
.Text = searchs.Fields(16)
.Col = 17
.ColWidth(17) = 2000
.Text = searchs.Fields(17)
.Col = 18
.ColWidth(18) = 2000
.Text = searchs.Fields(18)
.Col = 19
.ColWidth(19) = 2000
.Text = searchs.Fields(19)
.Col = 20
.ColWidth(20) = 2000
.Text = searchs.Fields(20)
.Col = 21
.ColWidth(21) = 2000
.Text = searchs.Fields(21)
.Col = 22
.ColWidth(22) = 1000
.Text = searchs.Fields(22)
.Col = 23
.ColWidth(23) = 1000
.Text = searchs.Fields(23)
.Col = 24
End With
searchs.MoveNext
Loop
End Sub
Private Sub Command2_Click()
Combo1.Text = " "
MSFlexGrid1.Text = " "
End Sub
Private Sub Command4_Click()
UserNamePage.Show
UserExtraCurricularsPage.Hide
End Sub
Private Sub Command3_Click()
HomePage.Show
UserExtraCurricularsPage.Hide
End Sub
Private Sub Command5_Click()
End
End Sub
Private Sub Form_Load()
cn.ConnectionString = "Provider = MSDAORA.1; Password = tiger; User ID = scott; Data Source = srm; Persist Security Info = True"
cn.Open
With MSFlexGrid1
.Rows = 1
.Row = 0
.Col = 0
.ColWidth(0) = 1500
.Text = "ROLLNO"
.Col = 1
.ColWidth(1) = 3000
.Text = "NAME"
.Col = 2
.ColWidth(2) = 1500
.Text = "CLASS"
.Col = 3
.ColWidth(3) = 1000
.Text = "YRAD"
.Col = 4
.ColWidth(4) = 600
.Text = "YOGA"
.Col = 5
.ColWidth(5) = 600
.Text = "KARATHE"
.Col = 6
.ColWidth(6) = 800
.Text = "NCC"
.Col = 7
.ColWidth(7) = 1500
.Text = "NSS"
.Col = 8
.ColWidth(8) = 1500
.Text = "CRICKET"
.Col = 9
.ColWidth(9) = 1500
.Text = "FOOT BALL"
.Col = 10
.ColWidth(10) = 1500
.Text = "VOLLEY BALL"
.Col = 11
.ColWidth(11) = 1000
.Text = "BASKET BALL"
.Col = 12
.ColWidth(12) = 800
.Text = "CHESS"
.Col = 13
.ColWidth(13) = 1500
.Text = "TENNIS"
.Col = 14
.ColWidth(14) = 1500
.Text = "SNOOKER"
.Col = 15
.ColWidth(15) = 1500
.Text = "TABLE TENNIS"
.Col = 16
.ColWidth(16) = 2000
.Text = "DANCE"
.Col = 17
.ColWidth(17) = 2000
.Text = "SINGING"
.Col = 18
.ColWidth(18) = 2000
.Text = "INSTRUMENT"
.Col = 19
.ColWidth(19) = 2000
.Text = "ARTWORK"
.Col = 20
.ColWidth(20) = 2000
.Text = "DRAMA"
.Col = 21
.ColWidth(21) = 2000
.Text = "MONOACT"
.Col = 22
.ColWidth(22) = 1000
.Text = "PAINTING"
.Col = 23
.ColWidth(23) = 1000
.Text = "SKETCHING"
.Col = 24
End With
Combo1.AddItem "YOGA"
Combo1.AddItem "KARATHE"
Combo1.AddItem "NCC"
Combo1.AddItem "NSS"
Combo1.AddItem "CRICKET"
Combo1.AddItem "FOOT BALL"
Combo1.AddItem "VOLLEY BALL"
Combo1.AddItem "BASKET BALL"
Combo1.AddItem "CHESS"
Combo1.AddItem "TENNIS"
Combo1.AddItem "SNOOKER"
Combo1.AddItem "TABLE TENNIS"
Combo1.AddItem "DANCE"
Combo1.AddItem "SINGING"
Combo1.AddItem "INSTRUMENT"
Combo1.AddItem "ARTWORK"
Combo1.AddItem "DRAMA"
Combo1.AddItem "MONOACT"
Combo1.AddItem "PAINTING"
Combo1.AddItem "SKETCHING"
End Sub
this is the coding for ms flex grid... plz help me out to connect between those two forms and display the saved check box choices in ms flex grid...
its very urgent plz help me...
diva.