VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



the code is supposed to add date of death(dod) and date of birth but when adding new record i what

by pardon blessings (1 Submission)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 21st February 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)

the code is supposed to add date of death(dod) and date of birth but when adding new record i what the code to first check and make sure that

API Declarations


Dim tbl As Recordset
Dim wks As Workspace
Dim db As Database

Rate the code is supposed to add date of death(dod) and date of birth but when adding new record i what



Set wks = DBEngine.Workspaces(0)
Set db = wks.Databases(0)
Set tbl = db.OpenRecordset("tbl", DB_OPEN_DYNASET)
wks.BeginTrans

criteria = "[dod]='" & [txtdod] & "'"

tbl.FindFirst criteria

If tbl![dod] = txtdod Then
MsgBox "date already exists"
txtdod = ""
txtdod.SetFocus
Exit Sub
Else
tbl.AddNew
tbl![dod] = txtdod
tbl![dob] = txtdob
tbl.Update
End If
wks.CommitTrans
End Sub


Download this snippet    Add to My Saved Code

the code is supposed to add date of death(dod) and date of birth but when adding new record i what Comments

No comments have been posted about the code is supposed to add date of death(dod) and date of birth but when adding new record i what . Why not be the first to post a comment about the code is supposed to add date of death(dod) and date of birth but when adding new record i what .

Post your comment

Subject:
Message:
0/1000 characters