-
I am new to vb, and I am currently developing an application accessing an Access database. I don`t know how to create a SAVE command, and I would also like to search the database and display a message when the desired record is not found.
Can somebody tell me how to do thisÉ Thanks.
Tiger
-
Please type 'save' (find) at Demo project you will find a lot of Demo program.
-Khamal-
:)
-
Hope this can help you.
Set Wrk = DBEngine.workSpace(0)
Set Db = Wrk.Opendatabase("<Your Database>",False,False)
Set Rs = Db.OpenRecordset("<Your Table>", dbOpenDynaset)
:Problem 1:
With Rs
.AddNew
!<Your Field Name> = <Your Value>
.Update
End With
:Problem 2:
If Rs.RecordCount = 0 Then MsgBox "No record found.", vbInformation + vbOKOnly
Rs.Close
Wrk.Close
Db.Close
Set Rs = Nothing
Set Wrk = Nothing
Set Db = Nothing
_____________________
Chris.C :)
[email protected]