|
-
October 14th, 2010, 07:26 PM
#1
Problem on .AddNew function
hi guys, i have a small problem on my .AddNew function
hope you can help me on this...
so here's my problem... every time i click my "Save Info" button, which is by the way my .AddNew function, it starts to mess up my database, how?
every time i started to add new information of an employee on my database it skips 2 rows from the table where that information must be saved, then the .AddNew function will save the information to the 3rd row and if i add again another information, the .AddNew function will overwrite the saved information on the 3rd row and replaces the information their with the newly added one.
so basically all the information that i have saved and i will be saving is stucked on the 3rd row!
hope you guys could help me on this.... thanks very much !
here's my coding for my "Save Info" button
Private Sub btnSave_Click()
If txtID.Text = "" Or txtLN.Text = "" Or txtFN.Text = "" Or txtMN.Text = "" Or txtADD.Text = "" Or txtPN.Text = "" Or txtEM.Text = "" Or txtDB.Text = "" Or txtDH.Text = "" Then
MsgBox "Incomplete Data..", vbCritical, "Empty"
Else
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("Employee ID").Value = txtID.Text
Adodc1.Recordset.Fields("Last Name").Value = txtLN.Text
Adodc1.Recordset.Fields("First Name").Value = txtFN.Text
Adodc1.Recordset.Fields("Middle Name").Value = txtMN.Text
Adodc1.Recordset.Fields("Address").Value = txtADD.Text
Adodc1.Recordset.Fields("Phone no").Value = txtPN.Text
Adodc1.Recordset.Fields("e-Mail").Value = txtEM.Text
Adodc1.Recordset.Fields("Date Hired").Value = txtDH.Text
Adodc1.Recordset.Fields("Date of Birth").Value = txtDB.Text
Adodc1.Recordset.Fields("Company Division and Job Designation").Value = lblDivisionDesignation.Caption
Adodc1.Recordset.Fields("Hourly Pay").Value = lblHP.Caption
Adodc1.Recordset.Fields("Job Status").Value = lblJS.Caption
Adodc1.Recordset.Update
Adodc1.Recordset.Requery
Adodc1.Refresh
MsgBox "One record Appended"
txtID.Text = ""
txtLN.Text = ""
txtFN.Text = ""
txtMN.Text = ""
txtADD.Text = ""
txtPN.Text = ""
txtEM.Text = ""
txtDB.Text = ""
txtDH.Text = ""
lblJS.Caption = ""
lblHP.Caption = ""
lblDivisionDesignation.Caption = ""
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|