View Full Version : Access Developers Kit
Movian
07-22-2009, 09:49 AM
Hey,
Im thinking of compiling a developers kit database that could be used as a code repo or as a compiled ACCDE / MDE for additional functions and subs.
This kit would contain for example, Office Constant lists, Encryption funcionts (MD5, SHA etc) aswell as many other usefull pieces that i have found (and created) such as a function to determin if an office app is installed. (returning true or false)
points to inches, inches to points, check if a string is a number
Address location system from ZIP
and more
Is this something you guys may be interested in ?
Do you have any specific functions that you want to offer to get put in ? or any suggestions for functions that should be included.
This would probably be released free and donations strongly encouraged or a small ($3 or $4) to help with website maintenance as this would be release on a website me and a friend are working on.
So your thoughts ?
It sounds interesting, I am quite happy to provide a copy of all my Routines for you to include in it.
Disable Close Cross
File searching
Folder Browse
File Browse
Comparing Fields before and after "Update"
Disable Shift bypass when opening.
Plus anything else I can find that I can't remember :yes
FrymanSMU
07-22-2009, 02:55 PM
Security and email functions are always nice
Movian
07-22-2009, 03:37 PM
could you expand on e-mail functions ?
i am already considering setting up a secure log in system
event logging and possibly error handling systems
although the specifics are yet undecided
~ok spent a bit of time going through the functions i have and thought i would produce a prelimary list. Let me know what you think, if you know any of the Unknown Authors then please let me know. Also let me know if you don't think something would be useful and of course please feel free to e-mail me subs procedures or classes Or put your code up here :) . All authors will be given full credit please include a comment block at the start of your code and annotate the code with comments. A lot of the work i have to do is annotating the code from the Unknown Authors (and some of my own)
An Example comment block
'////////////////////////////////////////////////////////////////////
'Password masked inputbox
'Allows you to hide characters entered in a VBA Inputbox.
'
'Code written by Daniel Klann
'March 2003
'////////////////////////////////////////////////////////////////////
Constants lists
Microsoft Word Constants List
Microsoft Excel Constants List
Classes
Crypto Class
Function SHA256(sMessage As String) As String
Returns the SHA256 value of a passed string
Unknown Author
Function Encrypt(ByVal TextVal As String, Optional Offset As Variant) As String
Returns a string that uses basic ascii encryption
Movian
Function Decrypt(ByVal TextVal As String, Optional Offset As Variant) As String
Decrypts string created using Encrypt
Movian
Functions
Function MD5_string(strMessage As String) As String
Returns MD5 String of passed String
David Ireland (need written permission to use this unless someone else has a function for this)
Function isAppThere(appName) As Boolean
Returns true or false for if stated office application is installed
Unknown Author
Public Function InchesToPoints(inches As Double)
Pretty Straight forward
Movian
Public Function PointsToInches(points As Double)
Pretty Straight forward
Movian
Public Function isnum(valuestring As String)
Returns True if passed string only contains numbers
Movian
Public Function cusbox(message As String, Optional caption As String, Optional boxtype As String, Optional button As String)
UNDER CONSTRUCTION!The concept is to create a more flexable msgbox such as setting the text on the button.
Movian
Public Function GetCity(Zip As String)
Returns the city for a given Zip
Movian
Public Function GetState(Zip As String)
Returns the state for a given zip
Movian
Public Function VBComponentExists(VBCompName As String, Optional VBProj As VBIDE.VBProject = Nothing) AsBoolean
Returns True of False indcating if the VB compenent exists
Unknown Author
Public Function pfPositionCursor(ctl As Control, lngWhere As Long)
Positions cursor at the character liocation for the given form contro
Unknown Author
Public Function AddQuotes(Data As String)
Takes a semi colon delmited string and adds opening and closing quotes to each item then returns the string
Movian
Function GetPrimaryKeyName(tablename As String) As String
Returns the primary key name for the given table
Unknownauthor
Public Function Standate(shortdate As String)
Forces Access to keep leading 0's in the date
Movian
Public Function returnrand(func As RandomType)
Returns a random string of the required type such as text, telephone, social or e-mail (e-mail would be for example useifuhsef@siufhweifuh.com)
Movian
Function IsBetween(X, X1, X2, Optional IncExc = "inc") As Boolean
Determins if X is between x1 and x2 with inludes or excludes
Unkown Author
Function GetAllFilesInDir(strDirPath As String, Optional Extension As Variant) As Variant
Loop through the directory specified in strDirPath and save each ' file name in an array
Unknown Author
Function fOSMachineName() As String
Retuns the computer name
Unknown Author
Public Function AddEvent(user As String, eventtime As Date, eventtitle As String, eventtext As String, catagory As Integer)
Adds an event to event table for event logging system
Movian
Public Function createHTML(Remove As Boolean, path As String)
Creates an HTML file to archive event logs externally
Movian
Function ahtCommonFileOpenSave( _
Optional ByRef Flags As Variant, _
Optional ByVal InitialDir As Variant, _
Optional ByVal Filter As Variant, _
Optional ByVal FilterIndex As Variant, _
Optional ByVal DefaultExt As Variant, _
Optional ByVal Filename As Variant, _
Optional ByVal DialogTitle As Variant, _
Optional ByVal hWnd As Variant, _
Optional ByVal OpenFile As Variant) As Variant
Utelizes the familiar windows standard open save dialouge
Unknown Author
Public Function InputBoxDK(Prompt, Optional Title, Optional Default, Optional XPos, Optional YPos, Optional HelpFile, Optional Context) As String
Opens a standard Input box that obfuscates the characters so that it may be used to input passwords
Daniel Klann
SUBS
Public Sub QuickSort(ByRef SortArray As Variant, ByVal first As Long, ByVal Last As Long, ByVal PrimeSort As Integer, ByVal Ascending As Boolean)
Never actually ended up using this one but is supposed to sort an array quickly
Unknown Author
Public Sub KillProperly(Killfile As String)
Sets file atributes to allow for delete before killing the file
Unknown Author
Movian
07-23-2009, 08:15 AM
As a thought (and a bump sorry for double post but i thought my previous post was long enough as it was).
Maybe i should release this as two separate databases one that is an open .ACCDB that contains the bulk of the functions. Then ALSO a locked .ACCDE that contains a secure log in system, Event and error logging system and maybe a couple other things that would benefit from being secured.
What do you think on that release fashion
hansup
07-23-2009, 08:41 AM
Function MD5_string(strMessage As String) As String
Returns MD5 String of passed String
David Ireland (need written permission to use this unless someone else has a function for this) Hi Movian,
I have used MD5 code from Robert Hubley. It requires a DLL, but I believe it's not encumbered by any restrictions.
Here's two links in case you're interested:
http://freevbcode.com/ShowCode.Asp?ID=741
http://www.bullzip.com/md5/vb/md5-visual-basic.htm
Regards,
Hans
An Access 2000-2003 version would be nice as we don't all have 2007.
Movian
07-23-2009, 11:52 AM
Does anyone know of a calculation i can use to figure out how the size a label / Text box would need to be based on the number of characters ?
I am trying to develop my own version of the MsgBox that will allow slightly more flexability (Such as setting the text on the button custom images and or form colours, alter wether the box is modal, pop up or like a regular form)
If anyone can help me in this respect i would greatly appreciate it
hansup
07-23-2009, 12:10 PM
Does anyone know of a calculation i can use to figure out how the size a label / Text box would need to be based on the number of characters ?Not sure what you have in mind, Movian.
In form design mode, you can right-click a text control, then choose Size->To Fit. I'm sure you know that already, but I'm wondering if you want to do it from code.
Alternatively, if you want to *compute* the space required to display a given number of characters, it seems like you would have to account for the attributes of the selected text: font family; font size; font weight; etc. That approach seems like a big challenge!
Movian
07-23-2009, 12:15 PM
yes essentially its going to be a custom message box so the text is going to be parsed as a param. And could be any length, so i need to find a way to calculate the size required so that the custom message box form can auto re size like the normal msgbox does
hansup
07-23-2009, 02:56 PM
yes essentially its going to be a custom message box so the text is going to be parsed as a param. And could be any length, so i need to find a way to calculate the size required so that the custom message box form can auto re size like the normal msgbox doesI can determine the width and height of a label control after loading text into it and calling the SizeToFit method. Would that help?
Public Sub testResize()
Const strTarget As String = "lblTarget"
Const strForm As String = "frmResizeLabel"
Dim ctl As Control
DoCmd.OpenForm strForm, acDesign, , , , acHidden
Set ctl = Forms(strForm).Controls(strTarget)
ctl.Caption = "Four score and seven years ago " _
& " our forefathers brought forth upon this continent ..."
ctl.SizeToFit
Debug.Print "Width: " & ctl.Width
Debug.Print "Height: " & ctl.Height
Set ctl = Nothing
End Sub
Somewhere in your code you will probably want:
DoCmd.Close acForm, YourFormName, acSaveNo
But at least that gets you the dimensions of the resized label control.
Good luck,
Hans
Movian
07-24-2009, 12:18 PM
The problem with the sizetofit option is that the final database will need to have access to design mode meaning that if the person using the ADK wants to release an MDE/ACCDE or a database for use with run time then this function will not work...
Also after consideration mabye i should drop the MD5 crypto and instead have a more practical encryption method as MD5 is now beggining to be replaced the the likes of SHA and AES. So mabye an AES Encryption function / class would be more usefull.... thoughts ?
hansup
07-24-2009, 02:16 PM
The problem with the sizetofit option is that the final database will need to have access to design mode meaning that if the person using the ADK wants to release an MDE/ACCDE or a database for use with run time then this function will not work...Sorry I didn't even consider that issue. Maybe someone else can offer a useful suggestion.
Also after consideration mabye i should drop the MD5 crypto and instead have a more practical encryption method as MD5 is now beggining to be replaced the the likes of SHA and AES. So mabye an AES Encryption function / class would be more usefull.... thoughts ?When I was considering MD5, it was to determine whether data source files had changed since they were last imported into my database. So I was not concerned about MD5 crypto weaknesses.
But your considerations seem reasonable to me. Unfortunately I can't offer VBA code for those other methods.
Regards,
Hans
Movian
07-26-2009, 06:36 AM
Ok, i have removed MD5 (as i found out it wasn't working anyway ^_^;;) and i will look at implementing AES.
I also was wondering do you think it would be useful to implement some functions to assist in writing to text files?
something like
Function WriteLineToText (FileLocation as string, LineText as string, optional append as boolean)
Returns true on success and false on error
and or Readline from file (FileLocation as string)
Returns Line from text file as String
any thoughts?
I have been spending some considerable time, going through the functions and trying to comment them as best i can and am hoping to have the website and an Alpha release available some time this week.
hansup
07-26-2009, 09:34 AM
Ok, i have removed MD5 (as i found out it wasn't working anyway ^_^;;) and i will look at implementing AES.How do you intend to use encryption for Access applications? I'm curious because I haven't encountered a need yet, and it's a topic I seldom see mentioned on the newsgroups.
I also was wondering do you think it would be useful to implement some functions to assist in writing to text files?
something like
Function WriteLineToText (FileLocation as string, LineText as string, optional append as boolean)
Returns true on success and false on error
and or Readline from file (FileLocation as string)
Returns Line from text file as String
any thoughts?Yeah, I found it convenient to wrap text file operations. I experimented with a logger class to do something like that. I attached it in a sample database if you want to look at it.
I have been spending some considerable time, going through the functions and trying to comment them as best i can and am hoping to have the website and an Alpha release available some time this week.I'm looking forward to seeing that, Movian. Thanks for doing this.
Suggest you consider a different name, however. "Access Developers Kit" sounds like it's from Microsoft. How about "Movian's Access Toolkit"?
I ran across something on Stephen Lebans' site which looks closer to what you wanted for determining the dimensions of a chunk of text. See what you think:
http://www.lebans.com/textwidth-height.htm
Regards,
Hans
hansup
07-26-2009, 09:38 AM
Where the heck did my attachment go?!
Let me try again. :-)
Movian
07-26-2009, 12:19 PM
Well i have the need myself and thought others may too.
For example the hashing algorithms are used in some of my projects to create custom user log in systems for password encryption. Some of these projects also deal with transferring data over networks and even the internet (Such as sending licensing information to PHP scripts that then interact with SQL databases and send back info again) in both of these example situations it is desireable to have the data encrypted. Also there are other situations that may require this, for example inter database data transmission, Encryption of patient medical information within the database etc...
Thanks of the link :D that looks great and i am looking at implementing some of that stuff now!!
Dd you get my update of your ADK?
Movian
08-05-2009, 05:34 PM
I Did, i have not however had the time to look over it or start on getting the site up and running to host it... :(
Gimme a little more time and i will have something though
Movian
08-06-2009, 01:02 PM
Sorry for double post, but i thought that the update deserved a bump
I have the basics of my site setup, due to lack of time and template/plugin availability i am using Joomla and have a basic site up and running as such
http://www.appdepot.co.uk
This is where i shall be releasing the Kit.
Also i am still unsure of the name...
should it be "MDK" as in Movian's Development Kit
MADK "Movians Access Development Kit"
ATDK "The Access Developers Kit"
etc
Part of the problem is that although i have alot of my own procedures in there and im compiling the list im not sure if that warants me enough credit to call it MY kit.... as it contains a large amount of other peoples work too.
Well let me know what you think of the site and i will get the kit up as soon as possible
Movian
08-10-2009, 09:07 AM
Unable to edit for some reason so again i apologize for extra posts.
V 0.1 is up on the site, Please feel free to sign up on the site and hopefully by the time you read this i will have the mailing list setup if you want to sign up for that.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.