A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Slow A97 module running in A2002



 
 
Thread Tools Display Modes
  #1  
Old November 14th, 2005, 04:45 PM
external usenet poster
 
Posts: n/a
Default Slow A97 module running in A2002

Hi All,

I have the below module, which converts a database field from an
integer into a date format (UK Date .i.e dd/mm/yyyy).

Please see below:

Function ConvertDate(InputValue As Variant) As Variant
Dim lngDay As Long
Dim lngMonth As Long
Dim lngYear As Long

If IsNull(InputValue) = False Then
lngYear = InputValue \ 65536
lngMonth = (InputValue Mod 65536) \ 256
lngDay = InputValue - (lngYear * 65536) - (lngMonth * 256)
ConvertDate = DateSerial(lngYear, lngMonth, lngDay)
Else
ConvertDate = Null
End If

End Function


This ran quite quickly in Access 97 however now that I've exported it
into my Access XP database it is running a lot slower!!!

Can anyone see why it would be so slow now? Is there any improvements
that could be made to the module code??

Many Thanks for your help


Adam

  #2  
Old November 14th, 2005, 05:30 PM
Douglas J Steele
external usenet poster
 
Posts: n/a
Default Slow A97 module running in A2002

Realistically, you don't need such a function. Dates are stored as numbers:
there's no need to do any conversion to use the number as a date.

Look at the following code I just ran in the Debug window (Ctrl-G):

?Format(Date(), "#")
38670
?Format(38670, "dd/mm/yyyy")
14/11/2005



--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


" wrote in message
oups.com...
Hi All,

I have the below module, which converts a database field from an
integer into a date format (UK Date .i.e dd/mm/yyyy).

Please see below:

Function ConvertDate(InputValue As Variant) As Variant
Dim lngDay As Long
Dim lngMonth As Long
Dim lngYear As Long

If IsNull(InputValue) = False Then
lngYear = InputValue \ 65536
lngMonth = (InputValue Mod 65536) \ 256
lngDay = InputValue - (lngYear * 65536) - (lngMonth * 256)
ConvertDate = DateSerial(lngYear, lngMonth, lngDay)
Else
ConvertDate = Null
End If

End Function


This ran quite quickly in Access 97 however now that I've exported it
into my Access XP database it is running a lot slower!!!

Can anyone see why it would be so slow now? Is there any improvements
that could be made to the module code??

Many Thanks for your help


Adam



  #3  
Old November 14th, 2005, 05:46 PM
external usenet poster
 
Posts: n/a
Default Slow A97 module running in A2002

Will this work?? Seems so simple?

You see all of the calculations that my module is running?

  #4  
Old November 14th, 2005, 06:31 PM
Douglas J Steele
external usenet poster
 
Posts: n/a
Default Slow A97 module running in A2002

Sorry, you're right. Your encoding scheme is different than what Access uses
to store dates.

Can you change so that you do use the same scheme? (In Access, dates are
stored as the number of days relative to 30 Dec, 1899, and times are stored
as a fraction of a day)

I'm not sure there's any way to speed up your existing code.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


" wrote in message
ups.com...
Will this work?? Seems so simple?

You see all of the calculations that my module is running?



  #5  
Old November 14th, 2005, 07:42 PM
external usenet poster
 
Posts: n/a
Default Slow A97 module running in A2002

I'm using Access to pull data off of the SQL server. There is a call
logging program called RoyalBlue Touchpaper which records dates in this
format.

  #6  
Old November 14th, 2005, 08:33 PM
Douglas J Steele
external usenet poster
 
Posts: n/a
Default Slow A97 module running in A2002

Ouch. Not sure there's anything that can be done, then: nothing about your
code looks like it should be causing delays.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


" wrote in message
ups.com...
I'm using Access to pull data off of the SQL server. There is a call
logging program called RoyalBlue Touchpaper which records dates in this
format.



  #7  
Old November 14th, 2005, 08:38 PM
external usenet poster
 
Posts: n/a
Default Slow A97 module running in A2002

I've just been reading about these.

Are they good? How do you use them?

Wouldn't I just have the same problem? I still need to convert the
Touchpaper date into something recognisable..

I found this on the web, it explains that the date returned from
Touchpaper is a HEX format? Apparently it means something to
developers:
http://www.vbcity.com/forums/faq.asp...t=Date%2FTime&

Is this something I could do with Access Projects?

  #8  
Old November 14th, 2005, 08:58 PM
external usenet poster
 
Posts: n/a
Default Slow A97 module running in A2002

Ok, there's an example on this website:
http://www.vbcity.com/forums/faq.asp...t=Date%2FTime&

The hex sample: 131336971

This represents the date 11/11/2004 (dd/mm/yyyy)


Where are the queries and tables stored in an ADP ? I want to create
forms which show the queries etc. Are these all stored in the ADP
database? Is this still possible?

  #9  
Old November 14th, 2005, 09:06 PM
external usenet poster
 
Posts: n/a
Default Slow A97 module running in A2002

So it stores them locally, in the ADP? Or on the SQL server?

Also if I only have read-only access, does this effect anything?

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
with new print server, excel running slow intermittently Mcmaineacjam General Discussion 1 August 31st, 2005 03:09 PM
computer running very slow yvettemichele General Discussions 3 August 25th, 2005 04:07 PM
Macros running very slow in Excel 2003 ebeltran General Discussion 1 June 9th, 2005 07:04 PM
Macros running slow in Excel 2003 ebeltran General Discussion 0 March 8th, 2005 08:30 PM
report / running sum and sorting Wim Foblets General Discussion 1 October 6th, 2004 02:11 PM


All times are GMT +1. The time now is 07:30 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.