By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,790 Members | 1,430 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,790 IT Pros & Developers. It's quick & easy.

problem with global variables

P: n/a
hi ng

I got two huge problems:

1)
I have made a database that saves a users username a public variable when
the database opens.
When the database is shot down I wan't to save the time the user is leaving
the database, and in the "mainmenu form" I have made some vba under the
event: "shot down"

here it is:
Private sub form_close
Dim db As Database
Dim RSTOUT As Recordset
Dim strSQL As String

Set db = CurrentDb

strSQL = "select * from Tbl_BrugerLog"
Set RSTOUT = db.OpenRecordset(strSQL)

With RSTOUT
.AddNew
!Bruger = strUsername
!Tidspunkt = Now()
!Tekst = "Logger af"
.Update
End With
RSTOUT.Close

end sub

My problem is that it seems to reset the global variable just before it is
shotdown, so there is saved no name (the public variable is strUsername).

2) How do I hide the buttom in the right upper-corner that shot down the
database and access it selve?
Thanks in advance
Best regards
Henrik

Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Henrik Thomsen wrote:

When the database is sh[u]t down I wan't to save the time the user is leaving
the database, and in the "mainmenu form" I have made some vba under the
event: "sh[u]t down"
Henrik, is the main form open throughout the session? If so, save the
user name on a text box on the form and make the text box visible
property false.

2) How do I hide the buttom in the right upper-corner that shot down the
database and access it selve?


As far as I know, you can't. If the user shuts down the database and
your main form is open, it will close first, firing its on close event.
That's the sort of thing I always use.

--
Tim - http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Want some?" - Ditto
Nov 12 '05 #2

P: n/a
thanks alot Tim
"Tim Marshall" <tm******@Gunner.Sabot.Spam.On.Loaded.FIRE> skrev i en
meddelelse news:3F***************@Gunner.Sabot.Spam.On.Loaded .FIRE...
Henrik Thomsen wrote:

When the database is sh[u]t down I wan't to save the time the user is leaving the database, and in the "mainmenu form" I have made some vba under the
event: "sh[u]t down"


Henrik, is the main form open throughout the session? If so, save the
user name on a text box on the form and make the text box visible
property false.

2) How do I hide the buttom in the right upper-corner that shot down the
database and access it selve?


As far as I know, you can't. If the user shuts down the database and
your main form is open, it will close first, firing its on close event.
That's the sort of thing I always use.

--
Tim - http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Want some?" - Ditto


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.