creating a log file with MS Access

  • Thread starter Thread starter snipersix
  • Start date Start date
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.
 
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?
 
well my question is, how do i create a log file given this situation,
like what are the codes necessary to do this.
 
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())
 
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.
 
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.
 
where do you place this code

INSERT INTO TableName (UserNameField, LoginTimeField)
VALUES(CurrentUser, Now())
 
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.
 
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?
 
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.
 
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?
 
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.
 
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.
 
im sorry i made a mistake the error was

Run-time Error '3061'

too few parameters. expected1
 
Back
Top