Auto update table on Form Load

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi:

I have a splash screen (form) bounds to a tblLogin. The form has a txtbox
for userid (automatically captured network id) and currentdate (default value
=now()). I want to update my tblLogin everytime the Form loads. Thanks.

Allan
 
Are you limiting yourself to only when the form loads? Why?

Have you tried explicitly saving the record when the splash screen closes?

Good luck

Jeff Boyce
<Access MVP>
 
I'm assuming that the purpose is to create a log of everytime someon
runs the database - thus you want to insert a new recor

Ok, lets say

Splash Screen Form = frmSplas
User ID Textbox = txtUserI
Date Textbos = txtDat

And in tblLogin you have the fields: 'userID' and 'date'

I'd personally put the event as an On Close event since when th
Splash Screen has closed it probably means they are on the databas
properly - it could crash or something before they actually enter th
database

In any case the code should be something like this (untested and mad
up on the spot but it should give you an idea)

strSQL = "insert into tblLogin
strSQL = "INSERT INTO [tblLogin] (userID, date
VALUES ('" & txtUserID & "', '"
txtDate & "');

If you need any more specific details or if this isn't what you'r
aiming for then let me know.[/code
 
Not quite sure what happened there... lets try again :

strSQL = "INSERT INTO [tblLogin
(userID, date) VALUES ('" & txtUserID
"', '" & txtDate & "');
DBEngine(0)(0).Execute strSQL, dbFailOnErro

That's better :
 
Your assumption was correct, I'm tracking the user's login. I'll try to
incorporate your codes. Thank you very much.
 
Hi:

I'm having a problem with your codes, it cause 'Variable not defined' for
the 'dbFailOnError'. And when I omit it, the error is "Syntax Error in
INSERT INTO statement'. Sorry, but I'm just a beginner, so I need a complete
codes. Thanks.


Jologs said:
Your assumption was correct, I'm tracking the user's login. I'll try to
incorporate your codes. Thank you very much.

--
Allan


Pringle9984 said:
Not quite sure what happened there... lets try again :)

strSQL = "INSERT INTO [tblLogin]
(userID, date) VALUES ('" & txtUserID &
"', '" & txtDate & "');"
DBEngine(0)(0).Execute strSQL, dbFailOnError


That's better :)
 
Back
Top