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  dBforums > PC based Database Applications > Microsoft Access > DBForums Code Bank

Reply
 
LinkBack Thread Tools Display Modes
  #31 (permalink)  
Old 05-27-07, 14:17
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Remote Sharing Sample

This example is to be used for MSAccess databases with SQL Server linked tables. When you click the "Find Users Logged In" button in the example, you are prompted for the SQL Server name (this can automatically be coded). Notice that a text file is also generated in the folder called: remoteshareinfo.log. You can then select one of the other buttons to see users in the MSAccess files and which ones they are in as well as other information.
Attached Files
File Type: zip RemoteSharingInfoLatest.zip (79.7 KB, 499 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
Reply With Quote
  #32 (permalink)  
Old 06-01-07, 14:33
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Creating a Right-Click PopUp Menu

This example shows how to quickly create a right-click popup menu.
Attached Files
File Type: zip SamplePopUpMenuRightClicking.zip (10.8 KB, 751 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
Reply With Quote
  #33 (permalink)  
Old 06-05-07, 10:24
Grafixx01 Grafixx01 is offline
Registered User
 
Join Date: Aug 2006
Posts: 559
Security Demo DB WITHOUT using Access ULS

Here's the security demo database that I found and used in the creation of my database. It's pretty good and does not use the MS Access User Level Security that is built into Access. I've found it much easier to use this versus the ULS in Access because there can be major issue with the Access ULS if its not done correctly or if the db administrator leaves and does not tell the replacement everything.
Attached Files
File Type: zip SecurityDemo.zip (198.0 KB, 718 views)
Reply With Quote
  #34 (permalink)  
Old 06-06-07, 15:08
nckdryr nckdryr is offline
Computer Monkey
 
Join Date: May 2005
Location: Oregon
Posts: 1,191
ActiveX Calender Control

This example shows how to use the inbuilt Calender ActiveX control to load a date into a text box/combo box, using only a single calender control for multiple text boxes on the screen.
Attached Files
File Type: zip Calender.zip (14.3 KB, 465 views)
__________________
Me.Geek = True
Reply With Quote
  #35 (permalink)  
Old 06-27-07, 08:22
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,002
File System Object & Adding References Programatically

The attached database is a small example of how we can use the file system object (FSO) in Access for "attaching" files to our database.

the FSO is very customizable, allowing you to add your own filters etc - many examples are applied in this project.

Any paths and names of files selected using the FSO are stored in a table in the database, this can be very useful for bookmarking files, creating favourites list etc etc.

The FSO object requires the use of a reference called "Microsoft Office Object Library 10.0" (or above). The On_Load() event of the form automatically checks the access version and adds the reference by GUID.
More information on GUID's can be found here.

The code is commented pretty well but if you have any questions then feel free to PM me.
-------------------
EDIT: 2007-06-28
Added more functionality including a variation on the FSO which allows you to select folders as opposed to files. Minor coding tweaks and tidying up.
-------------------

~ George
Attached Files
File Type: zip FSO.zip (43.6 KB, 588 views)
__________________
George
Twitter | Blog

Last edited by gvee; 06-28-07 at 10:27.
Reply With Quote
  #36 (permalink)  
Old 07-06-07, 00:05
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Reporting system with a date range and city criteria

This attachment demonstrates how to create a report based on a date range and city criteria off of a form. The example has a nice calendar system that is completely button driven so the user never has to enter a month, day or year except to click a button.

If you want to base your totals on a date range or some other criteria, take a look at this example. This example also tests to see if the StartDate is after the EndDate on the form.

The example also utilizes making a temp MeasureTotals table to demonstrate the ability to re-run the same report without having to re-query the database (if your data table is extremely large and it takes several minutes to run the query, you can open the same report without re-querying unless you change the criteria). This can be changed so that the report is based off of the query verses the table if need be.

Special thanks goes to Dave Bussan for his contribution on the coding for this.
Attached Files
File Type: zip SampleReportingSystem.zip (927.7 KB, 451 views)
File Type: zip ReportExampleNEW.zip (191.4 KB, 361 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Last edited by pkstormy; 10-19-07 at 11:57.
Reply With Quote
  #37 (permalink)  
Old 07-06-07, 00:59
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
ODBC DSN Creator/Refresher

This sample allows you to automatically create ODBC DSN's on a user's machine rather than doing it manually.

Simply link your tables into this mdb file and click the update button from the user's machine and an ODBC DSN will be created on that user's machine for each linked table database that it recognizes. It automatically recognizes the data source name associated with the linked table so you never have to worry about misspelling the name.

A good tool for distributing your SQL Server linked table Access files. Thanks goes to Dan Wang for his contribution.
Attached Files
File Type: zip ODBCDSNCreator.zip (107.1 KB, 516 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Last edited by pkstormy; 09-17-07 at 13:21.
Reply With Quote
  #38 (permalink)  
Old 07-11-07, 18:13
nckdryr nckdryr is offline
Computer Monkey
 
Join Date: May 2005
Location: Oregon
Posts: 1,191
Jet UserRoster on Form v2.0

Based on a tip from the inexorable Poots and from GolferGuy, and some other additions/modifications I've found useful over the last while, here's v2 of my previous post.

Simply copy the form from the attached dB and paste it into your form, making sure you have the Microsoft ActiveX Data Objects 2.1 Library referenced. Just add some way for you/the admin to access this form.

Enjoy!
Attached Files
File Type: zip JetUserLog_v2.zip (32.5 KB, 382 views)
__________________
Me.Geek = True

Last edited by nckdryr; 07-18-07 at 17:37.
Reply With Quote
  #39 (permalink)  
Old 08-11-07, 02:39
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Some Different Search Examples/Highlight Records in Continuous Forms

This shows some different techniques on searching for data in a table using several different ways. From simple search boxes to utilizing alphabetic buttons to using the OnChange event and other search ways. It also shows a query on how to handle blank valued fields. And how to do date criteria, and also an OR on a field criteria (all in 1 query!) Take the part that works for you. And the last example shows how you can highlight the current record on a continuous form.

Regarding the OnChange search form example, everything I've found uses some complex routine or issues a me.MySearchText.SelStart = me.MySearchText.SelLength command which causes a problem if a space is entered (ie..entering "All State" truncates when you push the space after "All" which makes the searching problematic.) Setting up a complex sql statement or some other complex routine with dozens of lines of code sounded unreasonable and I wanted to do it with 1 very simple query and only 2-3 lines of the simpliest code and method I could find (ie. NO complex Functions)!

So I played around with setting a boolean value to true or false depending on if the spacebar is pushed in the OnKeyPress event for the searchbox. The OnChange event of the searchbox then simply looks at the boolean value and will ignore firing if a spacebar is pushed.

On this search form it also automatically detects the email column of the listbox and is set up so you can quickly locate a name (such as in Outlook), and create an email with a few keystrokes.

Look at the "Sample Business Search Form 2" In this attachment to see how this works.

"Sample Business Search Form 1" is a typical search designed to quickly tab through alphabetical letter buttons.

"Sample Business Search Form 3" and the "Other Search Criteria" forms are some examples showing how you can query a database with blank field values in a search form. No need to write any complex code for searches because you need to search on multiple fields or you have null values in the records - you can do it with a simple expression in 1 very, very simple query!!

"Sample Business Search Form 4" shows you how to quickly select a field name and search for values in that field using the search for every character method. It also uses the up/down arrows in the listbox so you can scroll through the values in the listbox (by simply tabbing to the listbox - no mouse needed to click on the listbox).

There is also a sample form showing how you can highlight the current record you are on in a continuous form.

Again, There's NO complex sql code in any of these examples!! They all use 1 very simple query and only 3-4 lines of easy to understand code in the forms.

It's worth a look.

New version (fixed) and with more options to search by.
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Last edited by pkstormy; 01-26-08 at 04:10.
Reply With Quote
  #40 (permalink)  
Old 08-21-07, 08:06
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Storing file locations in a table and opening files

This is a very nice little menu system I developed for storing file locations and filenames in a table and then opening those files. It shows how you can populate a table with the file location and file name using the Dir() function with ANY file types and it also shows 3 different ways on how to open a stored filename (of any type) in a table. This program/utility has many, many features including:

1. Quickly search any drive/directory, find files of ANY specified type (ex: mdb, dll, exe, doc, xls, xlw, bmp, etc...etc....), and STORE those file locations in a table for quick access via the menu.
2. FSO file searching ability to find files of ANY type (You do NOT need the Office Object Library 10 or any other additional references in this mdb example).
3. "keyword" searches for filenames and quickly find any filepath/name with the wording "shortcut" or any wording you specify.
4. Code to open stored files of any types (3 different methods of opening files - if the first method fails, it automatically executes the 2nd method (which utilizes the windows file association). If that fails, it will prompt you for the program name to open the file.)
5. 2 listboxes on the main form, 1 to select files newer than the date you specifiy and the other to list files older than the date you specify.
6. Quick tabs for listing MSAccess, Word, Excel, and Picture files.
7. JetUsersLog incorporated into it to find any users in any specified mdb file.
8. Sort file listing by Date, foldername, or filename.
9. Tracks users and which files they open at what time.
10. Plus many, many more features - a great utility regardless if you're an MSAccess user or not.

There is also code in this utility to create a desktop shortcut to the users desktop for a selected file.

And lastly, there is code (in the main form's onLoad event) which will remove all of MSAccess menu's and only show the form (ie. see module2).

Hold down the shift key while opening to see the code behind the form.

Also has the resize module in it for resizing forms.
Also has the FormInfo module for removing caption bars or manipulating forms.

NEW VERSION - Just uploaded on 9/10/07!

New version uploaded 3/1/08! (MenuSystemInAccessByEDP2008 - trimmed out excess code).
Attached Files
File Type: zip MainMenuForStoringOpeningFiles.zip (458.6 KB, 680 views)
File Type: zip MainMenu11202007SQLServerVersion.zip (5.59 MB, 468 views)
File Type: zip MenuSystemInMSAccessByEDP2008.zip (226.4 KB, 589 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Last edited by pkstormy; 03-01-08 at 21:56.
Reply With Quote
  #41 (permalink)  
Old 08-27-07, 21:52
Brent Blevins Brent Blevins is offline
Registered User
 
Join Date: Jun 2007
Posts: 65
Programaticaly Embed or Link a file in an OLE File field

While this isn't rocket science, I have posted several times asking folks how to programaticaly embed a file into an OLE field from a form. I did not get any workable solutions. I am not sure if it is because I am the only one with a need to do this or if it is that no one knew how. So, after much digging and experimenting, I present to you a working solution if you have this need.

Important note:
Whether you are planning to Embed or Link the file, the "OLE Type Allowed" MUST be set to either for the Bound Object Frame.

The database consists of a form that opens when you open the database. When you click the "Attach File" button, a TextBox and a Bound Object Frame are displayed. The standard Windows File Open Dialog Box displays with a caption of "Select File to Attach!". The caption can be changed to suit your taste. Once a file is selected, it will be embedded or linked. The code currently Embeds the file. In order to Link the file (usefull for graphics files, comment out the Embed line and uncomment the Link line in the code.

I hope this is helpful to someone.


Enjoy,
Brent Blevins
Attached Files
File Type: zip OLE Insert.zip (38.3 KB, 327 views)
Reply With Quote
  #42 (permalink)  
Old 09-05-07, 14:11
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Jet User Log (modified)

The attached is a slightly modifed version of the JetUserLog_v2 nckdryr supplied above.

Modified are the following:

.AddItem removed from code (this was causing problems in MSAccess 2000 as this method is apparently not available for MSAccess 2000/earlier)

Added - capability to select the mdb file name.

Thanks goes to nckdryr for supplying the original code (thanks Nick!)
Attached Files
File Type: zip JetUserLogModified.zip (183.8 KB, 359 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
Reply With Quote
  #43 (permalink)  
Old 09-11-07, 16:35
jwalker343 jwalker343 is offline
Registered User
 
Join Date: Jul 2006
Posts: 108
Seperate notes/memos from detail record

something neat i designed and wanted to share...

This code allows you to use a button, that will open another form and reference the memo/notes field of that particular record.

In theory this is easy. however this code is designed so that a single "notes" form can be used for an unlimited number of other forms

example:
you have 4 tables all which have a notes portion

Vendors....Customers....Purchase Orders....Receipts

since they all have a common field "NOTES" you can create a single form named "notes" then use the following code on each of these forms to open the notes form and display the code for that particular record.


in this example frm_memonotes is my "notes" form
Code:
DoCmd.OpenForm ("frm_memonotes")
Forms.Item("frm_memonotes").SetFocus
Forms.Item("frm_memonotes").Form.Caption = me.caption " & [ID] & " MEMO"
Forms.Item("frm_memonotes").RecordSource = "SELECT " & Me.RecordSource & ".ID, " & Me.RecordSource & ".memo, " & Me.RecordSource & ".notes FROM " & Me.RecordSource & " WHERE " & Me.RecordSource & ".ID = " & Me.ID
Forms!frm_memonotes!Text0.ControlSource = "MEMO"
place in a button on any form.
Reply With Quote
  #44 (permalink)  
Old 09-16-07, 21:50
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Search through fields for designated text strings

The attached example shows a way you can enter key words in a table and search through a table/fields for those key words, storing the wording found after the key word match (until a space is found or another character you designate) in another table (where you specify the fields to store the values.)

For example, in the "SearchForValues" table you can enter RC: (and designate to store matches after RC: in the RC field) and MC: (and designate to store matches after MC: in the MC field), etc...etc... If the string value in the search field is RC: 334X MC: 333 ... 334X will be stored in the RC field and 333 will be stored in the MC field. You can have an unlimited number of search values to search for and fields designated to store the values in. It will loop through the entire search table searching for all matches of the designated values and storing the found values after the match in a table. You can also designate to exclude certain values in the string match so in the above example, you could choose to exclude X from the RC: match and 334 instead of 334X will be stored.

I've used this routine to import a file into a table and search through that table for key wording, storing the values after the key wording in a table. If you happen to find this useful, let me know.
Attached Files
File Type: zip SearchStringExample.zip (41.4 KB, 293 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Last edited by pkstormy; 09-16-07 at 22:36.
Reply With Quote
  #45 (permalink)  
Old 09-16-07, 22:13
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Different coding routines

The attached zip contains several word documents which have several different vba coding examples. For example, there are word documents which shows the following code in vba:

1. Relinking tables
2. Browse for a file
3. Bypass Autoexec
4. Calculate the first day of the month
5. Calculate work days
6. Change cursor
7. Linking tables
8. Compact and Repair
9. Concatenating
10. Convert a number to text
11. Convert a currency value to the written out string for a check (ie. $10.00 = Ten and 00/100 dollars)
12. Count mouse ticks
13. Create DSN's on the fly
14. Decompiling on the fly
15. Changing default printer
16. Change mouse pointer
17. Disable mouse wheel
18. Check to see if a table exists
19. Execute a DTS via vba
20. Extracting numbers from a text field
21. Get age example
22. Get Date function
23. Get FullName in a domain
24. Get rid of close X on a maximized form
25. Get UserName
26. Importing Outlook messages
27. Key stop code
28. Listing files in a directory
29. Map a network drive in vba
30. Detecting multiple users in the same mdb
31. Password prompt
32. Reading the registry in vba
33. Retrieve domain name
34. Running wizards via vba
35. Set priority to MSAccess
36. Shell command in vba
37. SQL Server syntax on Like statement
38. Output an MSAccess report to a PDF
39. Use FTP in MSAccess
Attached Files
File Type: zip WordDocsGoodSampleCode.zip (261.5 KB, 728 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Last edited by pkstormy; 09-17-07 at 11:43.
Reply With Quote
Reply

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


LinkBacks (?)
LinkBack to this Thread: http://www.dbforums.com/microsoft-access/1605962-dbforums-code-bank.html
Posted By For Type Date
Problem opening file, Error 3197 Post #0 Refback 08-11-10 17:45
Access 2003 - how to pass data from one from to an other Post #0 Refback 08-08-10 08:20
MSACCESS.exe has problems that MSARN200.exe doesn't - Page 2 Post #0 Refback 08-07-10 22:00
How to provide security to the database and source code? Post #0 Refback 08-03-10 12:52
User Level Security eliminated? Post #0 Refback 08-03-10 11:40
Developer Gone Cannot Access Database Structure Post #0 Refback 08-03-10 11:40
Force users to log off Post #0 Refback 08-03-10 10:54
Login form register Post #0 Refback 08-02-10 15:56
How to TRULY lock access to tables Post #0 Refback 08-02-10 09:22
Access to SQL Post #0 Refback 08-02-10 04:18
Locked for editing Post #0 Refback 08-02-10 03:27
open a secure database Post #0 Refback 08-02-10 02:18
Newbie : Need Information on Migrating Data to SQL This thread Pingback 08-02-10 01:03
Weighted-average inventory costing. This thread Refback 08-01-10 23:42
Find (and go to) a record.. - Access World Forums Post #0 Refback 07-29-10 15:18
Find (and go to) a record.. - Access World Forums Post #0 Refback 07-29-10 12:28
How to Not sync 5 tables in a 4 set replica? - Access World Forums This thread Refback 07-16-10 14:07
Appointment Reminder by Phone - UtterAccess Discussion Forums This thread Refback 06-26-10 11:44
How to Not sync 5 tables in a 4 set replica? - Access World Forums This thread Refback 05-26-10 08:45
Question Optimizing form on load - Access World Forums Post #0 Refback 05-19-10 14:26
Sidebar menu flyout - Access World Forums Post #0 Refback 05-18-10 19:26
Point of sale software - Access World Forums This thread Refback 05-13-10 04:01
Question Optimizing form on load - Access World Forums Post #0 Refback 05-12-10 15:39
How to link and display task based on user login - Access World Forums Post #0 Refback 05-09-10 04:56
replicated & non-replicated tables - Page 2 - Access World Forums Post #0 Refback 05-08-10 16:22
replicated & non-replicated tables - Page 2 - Access World Forums Post #0 Refback 05-08-10 04:00
Point of sale software - Access World Forums This thread Refback 05-07-10 06:37
Question Multiple FE connections - odd problem to solve. - Access World Forums Post #0 Refback 05-05-10 22:28
Point of sale software - Access World Forums This thread Refback 05-04-10 14:26
Question Optimizing form on load - Access World Forums Post #0 Refback 05-04-10 13:17
Question Export to Text File Error - Access World Forums Post #0 Refback 05-04-10 12:57
Question Export to Text File Error - Access World Forums Post #0 Refback 05-03-10 21:20
Killing locks and sessions in access - Access World Forums Post #0 Refback 05-03-10 16:16
How to link and display task based on user login - Access World Forums Post #0 Refback 05-03-10 15:25
Point of sale software - Access World Forums This thread Refback 05-03-10 13:01
Point of sale software - Access World Forums This thread Refback 05-03-10 06:40
Open different forms when in runtime - Access World Forums Post #0 Refback 05-03-10 06:21
Killing locks and sessions in access - Access World Forums Post #0 Refback 05-03-10 03:55
Point of sale software - Access World Forums This thread Refback 05-03-10 02:46
Question Export to Text File Error - Access World Forums Post #0 Refback 05-03-10 00:30
Question User level security - retrieving group membership - Access World Forums Post #0 Refback 05-02-10 00:39
Point of sale software - Access World Forums This thread Refback 05-01-10 19:49
Question User level security - retrieving group membership - Access World Forums Post #0 Refback 05-01-10 19:39
Sidebar menu flyout - Access World Forums Post #0 Refback 05-01-10 17:54
Sidebar menu flyout - Access World Forums Post #0 Refback 05-01-10 17:18
Open different forms when in runtime - Access World Forums Post #0 Refback 05-01-10 10:26
???? - jetutil.dll This thread Refback 04-30-10 11:03
belajar-access : Messages : 26142-26158 of 26582 Post #0 Refback 04-27-10 23:34
RE: [belajar-access] [Tanya] tal?Merubah Kotak Pesan (msgbox) Post #0 Refback 04-16-10 13:40
Re: [belajar-access] [Tanya] tal?Merubah Kotak Pesan (msgbox) Post #0 Refback 04-13-10 00:48
Hide Access and show only my forms Post #0 Refback 03-29-10 16:49
UtterAccess Discussion Forums - User-Level Security Question Post #0 Refback 12-11-09 12:59
user notification - Access World Forums Post #0 Refback 11-19-09 07:25
Finding the location of a database - Access World Forums Post #0 Refback 10-29-09 08:04
CodeProject: MS Access - Active Directory Role Membership. Free source code and programming help Post #0 Refback 08-08-09 02:17
CodeProject: MS Access - Active Directory Role Membership. Free source code and programming help Post #0 Refback 07-23-09 00:56
UtterAccess Discussion Forums - User-Level Security Question Post #0 Refback 06-01-09 19:16
UtterAccess Discussion Forums - User-Level Security Question Post #0 Refback 04-16-09 14:47
Microsoft: Access Forms - Updating Frontend Post #0 Refback 04-16-09 08:22
Microsoft: Access Forms - Updating Frontend Post #0 Refback 03-16-09 09:41
Microsoft: Access Forms - Updating Frontend Post #0 Refback 03-09-09 05:03
Crosstab values - Access World Forums This thread Refback 01-15-09 12:40