creating a log file with MS Access

S

snipersix

I currently have a database that uses MS Access, with a login system. I
used the built in security system of access to do this, which is in
(.MDW) format.

The problem i have now is that I want to create a log file of all the
people that logged in the database. Which means, it would display:
There username, date/time they logged in etc. My system also has a
splashscreen and a switchboard.
 
R

Rick Brandt

snipersix said:
I currently have a database that uses MS Access, with a login system. I
used the built in security system of access to do this, which is in
(.MDW) format.

The problem i have now is that I want to create a log file of all the
people that logged in the database. Which means, it would display:
There username, date/time they logged in etc. My system also has a
splashscreen and a switchboard.

And your question regarding that is?
 
S

snipersix

well my question is, how do i create a log file given this situation,
like what are the codes necessary to do this.
 
R

Rick Brandt

snipersix said:
well my question is, how do i create a log file given this situation,
like what are the codes necessary to do this.

Create the table with the desired fields. In your startup code run an append
query to add a row to that table.

EXAMPLE:

INSERT INTO TableName (UserNameField, LoginTimeField)
VALUES(CurrentUser, Now())
 
R

Rick Brandt

snipersix said:
where do i insert the code in my splash screen or in the table?

If you have a form that is automatically opened at startup you can execute the
query in the Open or Load event of that form.
 
R

Rick Brandt

snipersix said:
another question, what is the code for called an append query in a
form?

If you create a saved query you can use...

CurrentDB.Execute "QueryName", dbFailOnError

As an alternative the same command above could be used with a SQL statement
substituted for the query name.
 
S

snipersix

where do you place this code

INSERT INTO TableName (UserNameField, LoginTimeField)
VALUES(CurrentUser, Now())
 
R

Rick Brandt

snipersix said:
where do you place this code

INSERT INTO TableName (UserNameField, LoginTimeField)
VALUES(CurrentUser, Now())

That's not code. It's the SQL of an APPEND query.
 
S

snipersix

i notice that this code
CurrentDB.Execute "QueryName", dbFailOnError

doesnt seem to work. I placed it in the VBA code of my splash screen,
it doesnt run the append query automatically. But my append query is
working fine if i do it manually. why is that so?
 
R

Rick Brandt

snipersix said:
i notice that this code
CurrentDB.Execute "QueryName", dbFailOnError

doesnt seem to work. I placed it in the VBA code of my splash screen,
it doesnt run the append query automatically. But my append query is
working fine if i do it manually. why is that so?

What event did you use? It is not enough to just add code to a module. You
need an event handler that runs it.
 
R

Rick Brandt

snipersix said:
i used on load and pluged the code in. It gave me an error.

And the error was?

You did create a separate append query right?

You did replace "QueryName" in the code with the actual name of your append
query right?
 
S

snipersix

yes i did. But everytime i run the splash screen, which contains the
code, the debugger shows up, highlighting

CurrentDB.Execute "QueryName", dbFailOnError

It gives a Run-time error '3078'

The Microsoft Jet database engine cannot find the input table or query
'QueryName'. Make sure it exists and that its name is spelled
correctly.
 
R

Rick Brandt

snipersix said:
yes i did. But everytime i run the splash screen, which contains the
code, the debugger shows up, highlighting

CurrentDB.Execute "QueryName", dbFailOnError

It gives a Run-time error '3078'

The Microsoft Jet database engine cannot find the input table or query
'QueryName'. Make sure it exists and that its name is spelled
correctly.

And you are quite sure that the query you made is named "QueryName"? That error
means pretty much exactly what it sounds like.
 
S

snipersix

im sorry i made a mistake the error was

Run-time Error '3061'

too few parameters. expected1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top