Forcing a screen refresh before code continues

J

John Ortt

I have used the following code to kick unauthorised users out of my
database. The only problem I have is that the form I have which tells
people that the database is about to close does not refresh. It simply puts
the form frame on the screen with a hollow middle. Is there a way to force
Access to refresh the screen.

Thanks in advance,

John

P.S. This is a followup to the "Adding a delay before Code continues" topic.


Code follows:

Function Logoffcode()
Static MsgSent As Integer
Dim Logoff As Integer
Dim LO As Boolean

Set Db = CurrentDb() 'Note the table must be attached
'for CurrentDb() to work or use a
'connect string to the server db.

UserName = [Forms]![MainMenu].[UserBox]

If UserName = "BW643603" Then
[Forms]![MainMenu].OnTimer = ""
Else
docmd.Openform ("NonAuthorisedAccess")
[Forms]![MainMenu].OnTimer = ""
Call sSleep(5000)
Application.Quit
'Log them off

End If

End Function
 
S

solex

John,

I would open the form "NonAuthorisedAccess" as you are doing but would set
the timer value to something like 3-5 seconds, and in the form unload event
of the NAA form call Application.Quit.

Dan
 
J

John Ortt

Excellent.

That sounds a much better solution.

Thanks,

Dan


solex said:
John,

I would open the form "NonAuthorisedAccess" as you are doing but would set
the timer value to something like 3-5 seconds, and in the form unload event
of the NAA form call Application.Quit.

Dan

John Ortt said:
I have used the following code to kick unauthorised users out of my
database. The only problem I have is that the form I have which tells
people that the database is about to close does not refresh. It simply puts
the form frame on the screen with a hollow middle. Is there a way to force
Access to refresh the screen.

Thanks in advance,

John

P.S. This is a followup to the "Adding a delay before Code continues" topic.


Code follows:

Function Logoffcode()
Static MsgSent As Integer
Dim Logoff As Integer
Dim LO As Boolean

Set Db = CurrentDb() 'Note the table must be attached
'for CurrentDb() to work or use a
'connect string to the server db.

UserName = [Forms]![MainMenu].[UserBox]

If UserName = "BW643603" Then
[Forms]![MainMenu].OnTimer = ""
Else
docmd.Openform ("NonAuthorisedAccess")
[Forms]![MainMenu].OnTimer = ""
Call sSleep(5000)
Application.Quit
'Log them off

End If

End Function
 
K

Kevin K. Sullivan

If you actually need to fully display a form before a code loop try:

Me.Repaint 'update the current form's GUI

or

Forms(strFormName).Repaint 'update a different form's GUI

HTH,

Kevin

John Ortt said:
Excellent.

That sounds a much better solution.

Thanks,

Dan


solex said:
John,

I would open the form "NonAuthorisedAccess" as you are doing but would
set
the timer value to something like 3-5 seconds, and in the form unload event
of the NAA form call Application.Quit.

Dan

message
I have used the following code to kick unauthorised users out of my
database. The only problem I have is that the form I have which tells
people that the database is about to close does not refresh. It simply puts
the form frame on the screen with a hollow middle. Is there a way to force
Access to refresh the screen.

Thanks in advance,

John

P.S. This is a followup to the "Adding a delay before Code continues" topic.


Code follows:

Function Logoffcode()
Static MsgSent As Integer
Dim Logoff As Integer
Dim LO As Boolean

Set Db = CurrentDb() 'Note the table must be attached
'for CurrentDb() to work or use a
'connect string to the server db.

UserName = [Forms]![MainMenu].[UserBox]

If UserName = "BW643603" Then
[Forms]![MainMenu].OnTimer = ""
Else
docmd.Openform ("NonAuthorisedAccess")
[Forms]![MainMenu].OnTimer = ""
Call sSleep(5000)
Application.Quit
'Log them off

End If

End Function
 

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

Similar Threads

Adding a delay before code continues 3
Timer event not working. 4
Refresh tables code 1
LogUsersOff 0
LogUsersOff 0
HELP! VBA Code Stopping on Open 3
loop form 1
Refresh existing link problem. 4

Top