Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Error on St_ID data

$
0
0
Private Sub Form_Load()
DTPicker1.Value = DateValue(Now)
connect

SQL = "select St_ID from Student_Info"
Set rs = conn.Execute(SQL, adExecuteNoRecords)
If rs.EOF = False Then
UserID.Caption = Format(rs!St_ID.Value, "0000")
End If

connectclose
End Sub

Private Sub cmdSib_Click(Index As Integer)
If Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text7.Text = "" Or Text8.Text = "" Or Combo1 = "" Or Combo2 = "" Or Combo3 = "" Or Combo4 = "" Then
MsgBox "Please complete the information need.", vbExclamation, "Warning"
Else
connect
SQL = "INSERT INTO [Student_Info](St_ID,St_SName,St_FName,St_Mname,St_Gender,St_Year,St_Section,St_SY,St_Age,St_BDay,St_PName,St_PPhone,St_DateReg) VALUES ('" & UserID.Caption & "','" & StrConv(Text2.Text, vbUpperCase) & "','" & StrConv(Text3.Text, vbProperCase) & "','" & StrConv(Text4.Text, vbProperCase) & "','" & Combo1 & "','" & Combo2 & "','" & Combo4 & "','" & Text5.Text & "','" & Combo3 & "','" & DTPicker2 & "','" & StrConv(Text7.Text, vbProperCase) & "','" & Text8.Text & "','" & DTPicker1 & "')"
Set rs = conn.Execute(SQL, adExecuteNoRecords)
SQL = "update [Student_Info](St_ID) set St_ID=St_ID+1"
Set rs = conn.Execute(SQL, adExecuteNoRecords)
MsgBox "New information created.", vbInformation, "Success"
connectclose
Me.Hide
End If
End Sub


Public Sub connect()
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Sonata\diNvEr!\Thesis\ThesisProgram\Final Thesis Program\Thesis.mdb;Persist Security Info=False"
conn.CursorLocation = adUseClient
conn.Mode = adModeReadWrite
conn.Open
End Sub

Public Sub connectclose()
Set rs = Nothing
conn.Close
End Sub


Need help here... am just workin with this in the past 3days... i cant get along the ID Code... i wanted to start it to 0000 until 9999.. during registration, ID code must start to 0000 and save it on my database access.. then next will have 0001,0002,0003....

any help will be appreciated! tns and God bless

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>