heres what i ve done

Private Sub cmdtimein_Click()
If txtempno.Text = "" Then
     MsgBox "Please Input employee number!", vbExclamation + vbOKOnly, "Employee Record"
          Exit Sub
   Adotime.Recordset.MoveNext
Else
Adotime.Recordset.AddNew
Adotime.Recordset.Fields("employeeno").Value = txtempno.Text
Adotime.Recordset.Fields("timein").Value = Time
Adotime.Recordset.Fields("timeout").Value = Time
Adotime.Recordset.Fields("date").Value = Date
Adotime.Recordset.Update
MsgBox "You are time in!", vbInformation + vbOKOnly, "Employee Attendance"
End If
End Sub

Private Sub cmdtimeout_Click()
Adotime.Recordset.EOF
If txtempno.Text = Adotime.Recordset.Fields("employeeno") Then
Adotime.Recordset.AddNew ---- i wanna change this to .Edit but it wont come out
Adotime.Recordset.Fields("employeeno").Value = txtempno.Text
Adotime.Recordset.Fields("timeout").Value = Time
Adotime.Recordset.Fields("date").Value = Date
Adotime.Recordset.Fields("noofhoursworked").Value = DateDiff("h", Adotime.Recordset.Fields("timein"), Adotime.Recordset.Fields("timeout"))
Adotime.Recordset.Update
MsgBox "You are time out!", vbInformation + vbOKOnly, "Employee Attendance"
lblhour.Caption = DateDiff("h", Adotime.Recordset.Fields("timein"), Adotime.Recordset.Fields("timeout"))
End If
End Sub

how do u change it

Recommended Answers

All 6 Replies

change what?
Provide more information. explain more.

i would to change the adotime.recordset.addnew to adotime.recordset.edit
but i cant cuz the dropdown box would come out

i think its not edit you mean its update. adotime.recordset.update

or adotime.edit you don't have to include the word recordset

Inline Code Example Here

Adotime.edit ---- changing to "edit"
Adotime.Recordset.Fields("employeeno").Value = txtempno.Text
Adotime.Recordset.Fields("timeout").Value = Time
Adotime.Recordset.Fields("date").Value = Date
Adotime.Recordset.Fields("noofhoursworked").Value = DateDiff("h", Adotime.Recordset.Fields("timein"), Adotime.Recordset.Fields("timeout"))
Adotime.Recordset.Update

Hi,

Like ADO recordset, you dont have to write ".Edit" explicitly...
just change and save...
something like this :

ADOTime("MyField") = Text1.text
ADOTime.Recordset.Update

Just make sure, Recordset is Dynamically opened....

Regards
Veena

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.