473,401 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Why is this so slow

Hi Guru's,
Firstly, I'll apologise for the long post.
The scenario is that along with Access built in security, I have built my
own so to make it easier to enable/disable permissions on certain command
buttons, forms and enable accurate logging of useage. The problem is that
since I have added my own security, the database has gone really slow. For
example, when the database is opened, a login form appears (that bit is
normal speed). The user types in a userid and presses enter. The after
update property of the textbox uses a Dlookup function to make sure the
username is valid. It is normal at the moment to wait anything up to 20
seconds before the userid is validated.

The database is split on a XP platform using offive XP.

I am quite new to programming so a possibility is that my coding is the
cause of the sluggish behaviour. Below is the code I have on the userid
textbox after update property but it is not isolated to just this form. Can
anyone offer any advice as to what is wrong????

Private Sub userinput_AfterUpdate()
' Validate user id (name)
If IsNull(Me.userinput.Value) Or Me.userinput.Value = "" Then
MsgBox "Enter your User ID (Name) in the User ID field.", vbOKOnly,
"Missing User ID"
Me.passwordinput.Value = Null
Me.passwordinput.Visible = False
Me.userinput.SetFocus
Exit Sub
End If

' count user id entry attempts
If IsNull(DLookup("[userid]", "accees_ids", "[UserID]='" &
Me.userinput.Value & "'")) Then
Me.uidchk.Value = Me.uidchk.Value + 1
If Me.uidchk.Value > 3 Then
MsgBox "You may not make more than three User ID entry
attempts.", vbCritical + vbOKOnly, "Oops!"
DoCmd.Quit
End If
MsgBox Me.userinput.Value & " is not a valid account" & vbCrLf & _
"You have obviously not been given an account so please hit
the cancel button!!! ", vbOKOnly, "User ID " & Me.userinput.Value & "
Invalid"
Me.userinput.Value = Null
Exit Sub
End If

'Check to see if the password needs changing
If DLookup("[pwd]", "accees_ids", "[userid] = forms!access_login!userinput")
= Forms!access_login!userinput Then
MsgBox "As this is the first time you have used the database," _
& vbCrLf & "You are required to set a password", vbCritical = vbOKOnly,
"Change password"
Me.txtNewPW.Visible = True
Me.passwordinput.Visible = False
Me.openmain.Visible = False
Exit Sub
End If
'check to see if the password has expired
If DateDiff("m", DLookup("[chng_pwd]", "accees_ids", "[userid] =
forms!access_login!userinput"), Now()) >= 3 Then
MsgBox "3 months have passed!! You need to change your password",
vbCritical = vbOKOnly, "Expired Password"
Me.txtNewPW.Visible = True
Me.passwordinput.Visible = False
Me.openmain.Visible = False
Exit Sub
End If
' user id exists, continue
Me.passwordinput.Visible = True
Me.passwordinput.SetFocus

End Sub

Many thanks in advance,

Mark
Nov 13 '05 #1
3 1600
Hi Mark.

Without going into your code in detail, I doubt that it is causing a delay
of several seconds. This is much more likely to be related to other factors
such as NameAutoCorrect, the loading of the form, the Subdatasheet names,
the length of the network path, the non-caching of paths in Windows XP, etc.

For details, see Tony Toews' "Performance FAQ" at:
http://www.granite.ab.ca/access/performancefaq.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mark" <ma*********@ntlworld.com> wrote in message
news:7l*********@newsfe3-win.ntli.net...
Hi Guru's,
Firstly, I'll apologise for the long post.
The scenario is that along with Access built in security, I have built my
own so to make it easier to enable/disable permissions on certain command
buttons, forms and enable accurate logging of useage. The problem is that
since I have added my own security, the database has gone really slow. For
example, when the database is opened, a login form appears (that bit is
normal speed). The user types in a userid and presses enter. The after
update property of the textbox uses a Dlookup function to make sure the
username is valid. It is normal at the moment to wait anything up to 20
seconds before the userid is validated.

The database is split on a XP platform using offive XP.

I am quite new to programming so a possibility is that my coding is the
cause of the sluggish behaviour. Below is the code I have on the userid
textbox after update property but it is not isolated to just this form.
Can
anyone offer any advice as to what is wrong????

Private Sub userinput_AfterUpdate()
' Validate user id (name)
If IsNull(Me.userinput.Value) Or Me.userinput.Value = "" Then
MsgBox "Enter your User ID (Name) in the User ID field.", vbOKOnly,
"Missing User ID"
Me.passwordinput.Value = Null
Me.passwordinput.Visible = False
Me.userinput.SetFocus
Exit Sub
End If

' count user id entry attempts
If IsNull(DLookup("[userid]", "accees_ids", "[UserID]='" &
Me.userinput.Value & "'")) Then
Me.uidchk.Value = Me.uidchk.Value + 1
If Me.uidchk.Value > 3 Then
MsgBox "You may not make more than three User ID entry
attempts.", vbCritical + vbOKOnly, "Oops!"
DoCmd.Quit
End If
MsgBox Me.userinput.Value & " is not a valid account" & vbCrLf & _
"You have obviously not been given an account so please hit
the cancel button!!! ", vbOKOnly, "User ID " & Me.userinput.Value & "
Invalid"
Me.userinput.Value = Null
Exit Sub
End If

'Check to see if the password needs changing
If DLookup("[pwd]", "accees_ids", "[userid] =
forms!access_login!userinput")
= Forms!access_login!userinput Then
MsgBox "As this is the first time you have used the database," _
& vbCrLf & "You are required to set a password", vbCritical = vbOKOnly,
"Change password"
Me.txtNewPW.Visible = True
Me.passwordinput.Visible = False
Me.openmain.Visible = False
Exit Sub
End If
'check to see if the password has expired
If DateDiff("m", DLookup("[chng_pwd]", "accees_ids", "[userid] =
forms!access_login!userinput"), Now()) >= 3 Then
MsgBox "3 months have passed!! You need to change your password",
vbCritical = vbOKOnly, "Expired Password"
Me.txtNewPW.Visible = True
Me.passwordinput.Visible = False
Me.openmain.Visible = False
Exit Sub
End If
' user id exists, continue
Me.passwordinput.Visible = True
Me.passwordinput.SetFocus

End Sub

Many thanks in advance,

Mark

Nov 13 '05 #2
"Mark" <ma*********@ntlworld.com> wrote in message news:<7l*********@newsfe3-win.ntli.net>...
Hi Guru's,
Firstly, I'll apologise for the long post.
The scenario is that along with Access built in security, I have built my
own so to make it easier to enable/disable permissions on certain command
buttons, forms and enable accurate logging of useage. The problem is that
since I have added my own security, the database has gone really slow. For
example, when the database is opened, a login form appears (that bit is
normal speed). The user types in a userid and presses enter. The after
update property of the textbox uses a Dlookup function to make sure the
username is valid. It is normal at the moment to wait anything up to 20
seconds before the userid is validated.

The database is split on a XP platform using offive XP.

I am quite new to programming so a possibility is that my coding is the
cause of the sluggish behaviour. Below is the code I have on the userid
textbox after update property but it is not isolated to just this form. Can
anyone offer any advice as to what is wrong????

Private Sub userinput_AfterUpdate()
' Validate user id (name)
If IsNull(Me.userinput.Value) Or Me.userinput.Value = "" Then
MsgBox "Enter your User ID (Name) in the User ID field.", vbOKOnly,
"Missing User ID"
Me.passwordinput.Value = Null
Me.passwordinput.Visible = False
Me.userinput.SetFocus
Exit Sub
End If

' count user id entry attempts
If IsNull(DLookup("[userid]", "accees_ids", "[UserID]='" &
Me.userinput.Value & "'")) Then
Me.uidchk.Value = Me.uidchk.Value + 1
If Me.uidchk.Value > 3 Then
MsgBox "You may not make more than three User ID entry
attempts.", vbCritical + vbOKOnly, "Oops!"
DoCmd.Quit
End If
MsgBox Me.userinput.Value & " is not a valid account" & vbCrLf & _
"You have obviously not been given an account so please hit
the cancel button!!! ", vbOKOnly, "User ID " & Me.userinput.Value & "
Invalid"
Me.userinput.Value = Null
Exit Sub
End If

'Check to see if the password needs changing
If DLookup("[pwd]", "accees_ids", "[userid] = forms!access_login!userinput")
= Forms!access_login!userinput Then
MsgBox "As this is the first time you have used the database," _
& vbCrLf & "You are required to set a password", vbCritical = vbOKOnly,
"Change password"
Me.txtNewPW.Visible = True
Me.passwordinput.Visible = False
Me.openmain.Visible = False
Exit Sub
End If
'check to see if the password has expired
If DateDiff("m", DLookup("[chng_pwd]", "accees_ids", "[userid] =
forms!access_login!userinput"), Now()) >= 3 Then
MsgBox "3 months have passed!! You need to change your password",
vbCritical = vbOKOnly, "Expired Password"
Me.txtNewPW.Visible = True
Me.passwordinput.Visible = False
Me.openmain.Visible = False
Exit Sub
End If
' user id exists, continue
Me.passwordinput.Visible = True
Me.passwordinput.SetFocus

End Sub

Many thanks in advance,

Mark


It might be faster if you opened an updateable recordset based off the
single value and then you could manipulate all the info in memory
*already* instead of rereading from the tables using DLookup. Then if
you change anything, write it back to the record and update.
Nov 13 '05 #3
Hi all,
I went to Toney Toews' site and followed some of the performance tips
given. Eventually, I found that by opening a form bound to a table in the
backend first (it was set to invisible so no-one can see it) and then
opening the login form, the form responded almost instantaneously and has
cured all performance issues.

Thanks all for your advice

Mark

"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:41***********************@per-qv1-newsreader-01.iinet.net.au...
Hi Mark.

Without going into your code in detail, I doubt that it is causing a delay
of several seconds. This is much more likely to be related to other factors such as NameAutoCorrect, the loading of the form, the Subdatasheet names,
the length of the network path, the non-caching of paths in Windows XP, etc.
For details, see Tony Toews' "Performance FAQ" at:
http://www.granite.ab.ca/access/performancefaq.htm

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mark" <ma*********@ntlworld.com> wrote in message
news:7l*********@newsfe3-win.ntli.net...
Hi Guru's,
Firstly, I'll apologise for the long post.
The scenario is that along with Access built in security, I have built my own so to make it easier to enable/disable permissions on certain command buttons, forms and enable accurate logging of useage. The problem is that since I have added my own security, the database has gone really slow. For example, when the database is opened, a login form appears (that bit is
normal speed). The user types in a userid and presses enter. The after
update property of the textbox uses a Dlookup function to make sure the
username is valid. It is normal at the moment to wait anything up to 20
seconds before the userid is validated.

The database is split on a XP platform using offive XP.

I am quite new to programming so a possibility is that my coding is the
cause of the sluggish behaviour. Below is the code I have on the userid
textbox after update property but it is not isolated to just this form.
Can
anyone offer any advice as to what is wrong????

Private Sub userinput_AfterUpdate()
' Validate user id (name)
If IsNull(Me.userinput.Value) Or Me.userinput.Value = "" Then
MsgBox "Enter your User ID (Name) in the User ID field.", vbOKOnly, "Missing User ID"
Me.passwordinput.Value = Null
Me.passwordinput.Visible = False
Me.userinput.SetFocus
Exit Sub
End If

' count user id entry attempts
If IsNull(DLookup("[userid]", "accees_ids", "[UserID]='" &
Me.userinput.Value & "'")) Then
Me.uidchk.Value = Me.uidchk.Value + 1
If Me.uidchk.Value > 3 Then
MsgBox "You may not make more than three User ID entry
attempts.", vbCritical + vbOKOnly, "Oops!"
DoCmd.Quit
End If
MsgBox Me.userinput.Value & " is not a valid account" & vbCrLf & _ "You have obviously not been given an account so please hit the cancel button!!! ", vbOKOnly, "User ID " & Me.userinput.Value & "
Invalid"
Me.userinput.Value = Null
Exit Sub
End If

'Check to see if the password needs changing
If DLookup("[pwd]", "accees_ids", "[userid] =
forms!access_login!userinput")
= Forms!access_login!userinput Then
MsgBox "As this is the first time you have used the database," _
& vbCrLf & "You are required to set a password", vbCritical = vbOKOnly, "Change password"
Me.txtNewPW.Visible = True
Me.passwordinput.Visible = False
Me.openmain.Visible = False
Exit Sub
End If
'check to see if the password has expired
If DateDiff("m", DLookup("[chng_pwd]", "accees_ids", "[userid] =
forms!access_login!userinput"), Now()) >= 3 Then
MsgBox "3 months have passed!! You need to change your password",
vbCritical = vbOKOnly, "Expired Password"
Me.txtNewPW.Visible = True
Me.passwordinput.Visible = False
Me.openmain.Visible = False
Exit Sub
End If
' user id exists, continue
Me.passwordinput.Visible = True
Me.passwordinput.SetFocus

End Sub

Many thanks in advance,

Mark


Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Jawahar Rajan | last post by:
All, I am using the ASP code below to save some data from a SQL Server database via ADO as an Excel spreadsheet strReportName = Request.QueryString("ReportName") If len(strReportName) > 0 then...
12
by: Aykut Canturk | last post by:
We perfectly develop our applicaitons with VS 6.0. We want to move to .net but all of our development computers almost die with a small test application. we have min P4 2ghz and 512MB desktop PCs...
3
by: Mario Soto | last post by:
Hi. i hava a postresql 7.4.2 in a production server. tha machine is a Pentium IV 2,6 GHZ AND 1 GB IN RAM with lINUX RH 9.0. The postresql.conf say: ...
50
by: diffuser78 | last post by:
I have just started to learn python. Some said that its slow. Can somebody pin point the issue. Thans
10
by: Extremest | last post by:
I know there are ways to make this a lot faster. Any newsreader does this in seconds. I don't know how they do it and I am very new to c#. If anyone knows a faster way please let me know. All...
5
by: Goran | last post by:
I have VS 2005. It works very slow.I have centrino 1,5 processor, 512 MB ram and hdd 4200 rpm. What I need to change or upgrade, ram or hdd or processor?
1
by: SamSpide | last post by:
Hi all, I have a moderate-side 'Windows Form Application' (C++) project, with several forms. For some reason switching between code & designer views (right-click ;view code' or 'view...
0
by: Pratchaya | last post by:
In my.cnf i add these lines ####### log-bin log-slow-queries = /var/log/mysqld-slow.log long_query_time=1 #######
2
by: mezise | last post by:
Posted by Pratchaya: ------------------------------------------------------ MySQL Slow Log ERROR In my.cnf i add these lines ####### log-bin log-slow-queries = /var/log/mysqld-slow.log
39
by: cm_gui | last post by:
Python is slow. Almost all of the web applications written in Python are slow. Zope/Plone is slow, sloow, so very slooow. Even Google Apps is not faster. Neither is Youtube. Facebook and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.