Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Codes - Help!

Status
Not open for further replies.

paw

Technical User
Apr 7, 2000
40
US
Hi,

I'm not too bad at building a basic Access application with switchboards, macros, decent forms and reports, but I simply cannot get the hang of VBA coding and I'm afraid I'm going to need some code for the DB I'm working on now. People are going to have to sign on with an id and password to use this database and they want a field that shows the name of the last person who edited it (this field is called Update)and a field that shows the date it was last edited (this field is called (Date of Update). The form itself is called "Project Application" Can someone help me out with some code please. I am at my wits end. Much thanks.

paw
 
First off, I'd recommend using the standard Access security model to deal with usernames and passwords.
It is FAR easier than trying to code up a log in system for yourself and although not perfect, it is likely to be far more secure that anything that you come up with personally.
( General rules for you first DB with User/Group security:-
Download security articles / help topics and read them through.
Then read them through again to get the real message.
Then read them through and highlight key points.
Then take a copy of your database before touching it.
Then, when you actually do touch it - write down every username, passwork etc AS YOU DO IT. )


Once the user has logged in you can then get their Id simply using the build in function CurrentUser()

See the FAQ on this board FAQ700-2190 about avoiding space characters in ANY Access object.

Assuming you take that message on board the field names become
Update
DateOfUpdate
in a table called ??? Lets Say tblProject

So on the form ( now called frmProjectApplication ) you add two text box controls called Update and DateOfUpdate that are bound to the fields of the same name in the tblProject.

In the Before_Update event of the Form place the following code:-
Code:
Private Sub Form_BeforeUpdate()

If Me.Dirty Then
    Update = CurrentUser()
    DateOfUpdate = Date()
End If

End Sub



QED.

G LS
 
Thanks so much. I will give it all a try.

Paw
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top