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 Search this Thread Display Modes
  #121 (permalink)  
Old 09-06-10, 03:33
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Microsoft's Northwind Databbase example

Microsoft's Northwind database example.

Things I'd avoid using in the example:

1. Switchboard (design your own Main Menu which doesn't have a recordsource for the MainMenu itself - the form only has buttons which are coded to open other forms. It's not a good idea to have a form that's kept open the most based off of an actual table. Keep the recordsource for your MainMenu blank. It will avoid 'locking' type problems with multiple users (since one user 'sitting' in the MainMenu will eventually lock the corresponding *.ldb file).)

2. Lookup tab for fields - avoid using the Lookup tab for fields. This is often confusing when analyzing data and can make things more difficult versus easier when looking at data in a table. Instead just create a relationship on the Lookup table but avoid using the Lookup tab for joining any fields in a table. Instead, store just the actual number value itself in the field and try not to do anything fancy such as using the Lookup tab to show the corresponding text values. Save this for your queries themselves or just use comboxes on the forms.
Attached Files
File Type: zip NorthwindMDB.zip (779.2 KB, 94 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
Reply With Quote
  #122 (permalink)  
Old 09-06-10, 03:35
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Learn MSAccess by playing MSAccess Jeopardy

Attached is a fun MSAccess Jeopardy game I created a couple of years ago where you can learn about MSAccess Tables, Forms, Queries, Modules, Macros, Reports, Comboboxes, Tabs, Labels, and General MSAcccess stuff by playing MSAccess Jeopardy. It keeps track of your high scores and you can play against 2 randomly selected computer opponents.

Fully customizable where you can manipulate the buzz timer allowed to answer the questions, the skill levels of any computer opponents (Beginner, Intermediate or Advanced), add new computer opponents with different skill levels, pick certain categories a specific computer oponent likes the best, and other settings such as probabilities the computer opponents will answer correctly (and how fast they will buzz in against you). You can even adjust these settings in the middle of a game. You can make it so either of the computer opponents (or both) are always correct or give them a 50/50, 75/25 or any other odds you want that they will be correct. You can again, add new computer opponents giving them any name you want or remove ones so you can always play against tough or easy opponents. The computer opponents also have a random factor where they might 'second-guess' the answer they're going to give sometimes to make it more interesting (you'll see a message box appear that the computer is thinking through a better answer.)

You can also make this a tutorial for any subject (not just MSAccess), entering your own Title of the Subject Game and enter your own questions, answers and $ amounts.

It randomly creates the categories every time it plays adjusting the $100 to $500 questions and which answer is correct (ie. A, B, C or D so it's never the same game twice) or you can set your own $ amounts/add new questions to expand with new categories. The correct answer will be shown if answered incorrectly and you can make it so the computer opponents are easy or tough to play against (it randomly selects 2 new component oponents each new game ranging from whatever skill levels you want to play against.)

You can set it up so you have a limited amount of time to answer or unlimited amount of time when buzzing in. It's currently set to unlimited amount of time when buzzing in so you can take your time thinking about the possible answers displayed after clicking the "*** Buzz ***" button. (the only thing is that the computer will not select is the next question when they answer correctly - you must select the $ amount/category each time.)

Included is a 2000 and XP version of the mdb file so you can modify/look at the coding if need be (I just ask that you leave me with the credits in the code and on the Main Menu if modifying it.)

Note: Not tested with MSAccess 2007 or 2010 but it should work ok. Feedback if you like it or not is welcomed.

*** If the MSAccess file doesn't open, make sure to add this website to your intranet security in IE before downloading to then be able to open any MSAccess files within a zip download.
Attached Files
File Type: zip MSAccessJeopardyByPKStormy.zip (820.0 KB, 94 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
Reply With Quote
  #123 (permalink)  
Old 09-06-10, 03:39
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Miscellaneous examples from Sybex

The following are a few good miscellaneous examples from the MSAccess Developers book by Sybex, Ken Getz.

I utilize a lot of these examples and they are very helpful for any application.
Attached Files
File Type: zip MiscellaneousExamples.zip (780.8 KB, 199 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
Reply With Quote
  #124 (permalink)  
Old 01-01-11, 01:51
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Fake Background

An example of creating a 'fake' background form (for backend mdb's) so that if a user tries to open the backend, they don't see the actual tables.
Attached Files
File Type: zip FakeBackGround.zip (201.6 KB, 98 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
Reply With Quote
  #125 (permalink)  
Old 01-01-11, 01:54
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Logging Data Changes

An example showing a couple of ways to track field and record level changes, including tracking who and when they made the changes and to what fields/records. Also tracking who/when deleted a record.
Attached Files
File Type: zip LogDataChanges.zip (144.1 KB, 119 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
Reply With Quote
  #126 (permalink)  
Old 01-01-11, 01:58
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Unbound Form example

An example of an unbound form with functions to get/save data to/from the form.
Attached Files
File Type: zip UnboundFormExample.zip (27.1 KB, 86 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
Reply With Quote
  #127 (permalink)  
Old 04-26-11, 12:54
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Make your own Training Quizzes

This is a neat little Training Quiz program I designed. It lets you create your own questions/answers assigning them to a topic (where you can create new topics). You can also assign points to each answer, add more information to show after a question is answered, plus many other features.

You can also select your own character, select the character you want to ask you questions, and easily add new characters.

There's a game aspect to this where you try to reach the end of the map, competing with other characters to reach the end. There's a lot of extra features in this example which can also be used for other applications.

You can easily create any new Topics and add questions under those topics (ie. "For New Staff", "Database Related", "MSAccess Related", "Patient-Nurse Dialog Training", etc...etc...) It includes an "MSAccess Related" topic which has a hundred or so MSAccess questions (such as: "A combobox has...", "This property of a form does...", "What is bound versus unbound", etc...etc...)

Enjoy!

Note: You may need to refresh the linked tables if you're using another folder other than the 'C:\TrainingQuiz' folder (where it's looking for the backend StaffQuizTrainingXP_BE.mdb file.) It automatically knows though to look in \DBPics\ sub-folder for the pictures in whatever folder you've put TrainingQuiz.mdb in. Also, there's an 'import picture' routine which automatically adds whatever picture you select to the \DBPics\ sub-folder and renames that *.jpg file to SPictureX.jpg where X is the next sequential Picture in the folder (ex: you select a picture called: MyPortrait.jpg. It will copy MyPortrait.jpg to the \DBPics folder and automatically rename it SPictureX.jpg where X is the next sequential number - ie. SPicture23.jpg). That picture then becomes available for a user to select (ie. PictureNumber = 23).

Also note: Instead of saving a picture into the OLE Object field in the table (which would bloat the mdb), this uses a routine which saves the picture # (of the *.jpg filename itself). Thus, in the user table, the PictureNumber field might have a value of 4 for a user which tells the code to look for SPicture4.jpg in the \DBPics\ folder. This makes it very easy to change a Picture (ie. Picture Number) for a user and it will know the correct jpg picture to grab from the folder (this also applies to the PictureNumber field for the *.jpg picture of who will ask the questions.)

For example, as a user cycles through their selection of a Picture Numbers (ie. 1, 2, 3, 4...), as they cycle through each Picture Number, the code grabs SPicture1.jpg or SPicture2.jpg or SPicture3.jpg, etc... from the \DBPics folder to the MSAccess form (ie. it populates the .Picture property with the *.jpg name of the image field). The code knows what the last picture number of all the *.jpg pictures is in the \DBPics sub-folder so a user can't select Picture Number 30 if there isn't an SPicture30.jpg in the \DBPics sub-folder (ie. the Picture Numbers allowed for selection correspond to the X in SPictureX.jpg).

This same type of process can be used for other applications where storing the actual picture (or filename) isn't an option and instead, just a number is stored which corresponds to the number as part of the jpg filename itself.

.
Attached Files
File Type: zip CreateYourOwnTrainingQuiz.zip (1.94 MB, 110 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Last edited by pkstormy; 04-26-11 at 14:02.
Reply With Quote
  #128 (permalink)  
Old 08-03-11, 13:13
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Access 2010 Date Picker Replacement

This is a NON-ActiveX based and NON-API based Calendar looking form replacement for the Date Picker control in MSAccess 2010 (which requires you to click on a date field and then a calendar button to show the popup calendar). Since MSAccess 2010 removed the mscal.ocx activeX control, the Date Picker is currently the only option for 2010.

Since Access 2010 removed the mscal.ocx activeX control, the Access 2010 "Date Picker" is the only option. You must either replace the mscal.ocx control or register it separately (which I haven't tried yet.) Access 2007 did keep the mscal.ocx control. Why they removed it from 2010 is a good guess but there were probably some issues with it to maintain compatibility with 2010.

There are 2 forms, one to use as a subform and another which is a popup/modal and can be called from an OnClick or other event.

There is a subform ready Calendar looking form called: subCalendar that can be inserted into any main form (all the coding is embedded into the subform so you don't need to import any modules or queries or any other objects - just the form called: subCalendar into your accdb.) I used the .Caption to cycle through the buttons to determine the day value when a button is clicked which prevented the need for any API type coding.

IMPORTANT: The last function in the subCalendar form is called: FireOffDateValue. To use this form as a subform in your main form, simply put your coding in this function to populate any date value or requery any listbox/combobox on the main form.

example:

Function FireOffDateValue()
Me.myDate.Value = Me.myMonth.Value & "/" & Me.myDay.Value & "/" & Me.myYear.Value
Refresh
'Replace below with your code...
Forms!frmAvailabilityStaff!CalDate = Me.myDate.Value
Forms!frmAvailabilityStaff!ListDates.Requery 'Note that I requery after populating CalDate on the Main form since this listbox is based on the CalDate value.
End Function

Also included is a popup/modal version of the form called: CalendarPopUp
This form is to be used with a 'Calendar' type button (or any event procedure on any object) on the main form (or subform) - (see frmExamplePersons and the calendar button on that form for example coding to use for both main and sub forms). You basically issue a docmd.openform "CalendarPopUp" to open the form and then pass it 2 or 3 values (vFormName, vSubFormName, and vFieldName.) These are the same form names and field name from the form which you are opening the CalendarPopUp form.

Example:
me.BirthDate.setfocus 'to send the current Birthdate to the Calendar Popup
DoCmd.OpenForm "CalendarPopUp"
Forms!CalendarPopUp!vFormName = "frmExamplePersons"
Forms!CalendarPopUp!vSubFormName = "EnterSubformNameHere" for using with subforms!
Forms!CalendarPopUp!vFieldName = "BirthDate"


Also Note: This is in an accdb (2010) format.
Attached Files
File Type: zip PKStormysCalendarControlFor2010.zip (125.5 KB, 29 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

Last edited by pkstormy; 08-04-11 at 09:25.
Reply With Quote
  #129 (permalink)  
Old 08-10-11, 22:50
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Access 2003 Calendar Looking Sub form and PopUp

This is a Non-ActiveX and Non-API Access 2002-2003 version of a calendar looking form. It's setup to easily be integrated into any existing mdb (just import either the "CalendarPopUp" or "SubCalendar" form.) All code is contained within the form and there are no modules, API Calls, or need to register any *.ocx file.

The CalendarPopUp is called by a date field button or other event.

The subCalendar has 1 function (bottom function) called: FireOffDateValue where you can add your own code to copy the date value from the subform to your main form or requery a list box based upon it's value.

I utilize the .Caption of the button to grab the day value and prevent the need to use any API calls.

(this is the same as the 2010 version but in a 2003 format)
Attached Files
File Type: zip PKStormysCalendarControlFor2003.zip (145.1 KB, 33 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
Reply With Quote
  #130 (permalink)  
Old 08-14-11, 16:26
pkstormy pkstormy is offline
Moderator
 
Join Date: Dec 2004
Location: Madison, WI
Posts: 3,925
Access 2010 Date Picker

Here's a version with buttons to change the month or year and you can double-click on a date in the CalendarPopUp form.
Attached Files
File Type: zip PKStormysCalendarControlFor2010Buttons.zip (142.3 KB, 23 views)
__________________
Expert Database Programming
MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)
Reply With Quote
  #131 (permalink)  
Old 11-16-11, 11:16
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,250
please do not add questions to the code bank
by all means add questions as new threads.
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #132 (permalink)  
Old 12-23-11, 08:49
Sinndho Sinndho is online now
Registered User
 
Join Date: Mar 2009
Posts: 3,446
A Calendar Form With Events.

A Calendar Form With Events.
--------------------------

In a recent thread, the problem of working with an OCX calendar (MSCal.Calendar) was evoked and the proposed solution was to use a Calendar PopUp Form.

Although there are many examples of such calendars, several of them being very good (e.g. Microsoft Access tips: Popup Calendar), I decided to add my own contribution.

My solution has several specificities, among them:

1. It works in several countries with various Date/Time formats. The date format itself ('mm/dd/yyyy', 'dd/mm/yyyy', etc.) as well as the names of the months and of the weekdays change according to the Regional Settings of Windows (as defined in the Control Pannel).

2. It uses Events to communicate with its caller: no global variables are used, even if the Calendar form is open in Dialog mode.

3. It accepts several initialization parameters:
- First and last year in the Year Selection ComboBox.
- Selected date at opening.
- Continuous or "one-shot" communication with its caller.
- Title (caption) of the Form.
All these parameters have default values.

4. The number of rows displaying the days varies according to the disposition of a specific month (4, 5 or 6 rows).

5. Although that way of using it would be rather marginal, it can also be used as a SubForm.


The attached zip files contains an Access database (Acc. 2000 format) with the Calendar Form itself ('SF_Calendar'), a test Form working with the Calendar Form ('Frm_TestCalendar') and a Class Module ('Cls_Std_E_ChildCalendar') that works with the Calendar Form ('SF_Calendar').

For those who have troubles loading and opening zip files from this site, I also attached the three text files containing the source code of 'SF_Calendar' ('SF_Calendar.frm.txt'), 'Frm_TestCalendar' ('Frm_TestCalendar.frm.txt') and 'Cls_Std_E_ChildCalendar' ('Cls_Std_E_ChildCalendar.cls.txt'). To re-create the database from these files:

1. Copy the three files ('SF_Calendar.frm.txt', 'Frm_TestCalendar.frm.txt' and 'Cls_Std_E_ChildCalendar.frm.txt') into a folder.
2. Remove the '.txt' extensions, so to obtain the files 'SF_Calendar.frm', 'Frm_TestCalendar.frm' and 'Cls_Std_E_ChildCalendar.frm'.
3. Create a new (empty) Access database in the same folder.
4. In this database, create a new Module and paste this code into it:
Code:
Sub LoadSources()

    Application.LoadFromText acModule, "Cls_Std_E_ChildCalendar", CurrentProject.Path & "\Cls_Std_E_ChildCalendar.cls"
    Application.LoadFromText acForm, "Frm_TestCalendar", CurrentProject.Path & "\Frm_TestCalendar.frm"
    Application.LoadFromText acForm, "SF_Calendar", CurrentProject.Path & "\SF_Calendar.frm"
    
End Sub
5. Execute the sub 'LoadSources'.
6. When asked, accept the proposed names and save all.
7. Open the Form 'Frm_TestCalendar'
Attached Files
File Type: zip FormCalendar.zip (42.2 KB, 19 views)
File Type: txt Cls_Std_E_ChildCalendar.cls.txt (12.5 KB, 13 views)
File Type: txt Frm_TestCalendar.frm.txt (7.3 KB, 10 views)
File Type: txt SF_Calendar.frm.txt (29.7 KB, 11 views)
__________________
Have a nice day!
Reply With Quote
  #133 (permalink)  
Old 12-24-11, 15:50
cmays637 cmays637 is offline
Registered User
 
Join Date: Oct 2006
Posts: 86
Thanks for all the help throughout the years =)

Here is a example I made showing how to send emails (including attachments using your Google mail (Gmail) account through Access.

You'll need to modify with table with your environ ("username") full name, and gmail username, gmail password.

Enjoy.
Attached Files
File Type: zip DEMO email_example.zip (1.01 MB, 33 views)

Last edited by cmays637; 12-24-11 at 16:14.
Reply With Quote
  #134 (permalink)  
Old 02-03-12, 15:25
towerx towerx is offline
Registered User
 
Join Date: Feb 2012
Posts: 1
good to know

thanks for sharing
Reply With Quote
  #135 (permalink)  
Old 02-07-12, 20:44
nckdryr nckdryr is offline
Computer Monkey
 
Join Date: May 2005
Posts: 1,191
Keyword List from Memo Field in Table

For a way to generate a keyword list from a field in a table, see this post.
__________________
Me.Geek = True
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 16:45
Access 2003 - how to pass data from one from to an other Post #0 Refback 08-08-10 07:20
MSACCESS.exe has problems that MSARN200.exe doesn't - Page 2 Post #0 Refback 08-07-10 21:00
How to provide security to the database and source code? Post #0 Refback 08-03-10 11:52
User Level Security eliminated? Post #0 Refback 08-03-10 10:40
Developer Gone Cannot Access Database Structure Post #0 Refback 08-03-10 10:40
Force users to log off Post #0 Refback 08-03-10 09:54
Login form register Post #0 Refback 08-02-10 14:56
How to TRULY lock access to tables Post #0 Refback 08-02-10 08:22
Access to SQL Post #0 Refback 08-02-10 03:18
Locked for editing Post #0 Refback 08-02-10 02:27
open a secure database Post #0 Refback 08-02-10 01:18
Newbie : Need Information on Migrating Data to SQL This thread Pingback 08-02-10 00:03
Weighted-average inventory costing. This thread Refback 08-01-10 22:42
Find (and go to) a record.. - Access World Forums Post #0 Refback 07-29-10 14:18
Find (and go to) a record.. - Access World Forums Post #0 Refback 07-29-10 11:28
How to Not sync 5 tables in a 4 set replica? - Access World Forums This thread Refback 07-16-10 13:07
Appointment Reminder by Phone - UtterAccess Discussion Forums This thread Refback 06-26-10 10:44
How to Not sync 5 tables in a 4 set replica? - Access World Forums This thread Refback 05-26-10 07:45
Question Optimizing form on load - Access World Forums Post #0 Refback 05-19-10 13:26
Sidebar menu flyout - Access World Forums Post #0 Refback 05-18-10 18:26
Point of sale software - Access World Forums This thread Refback 05-13-10 03:01
Question Optimizing form on load - Access World Forums Post #0 Refback 05-12-10 14:39
How to link and display task based on user login - Access World Forums Post #0 Refback 05-09-10 03:56
replicated & non-replicated tables - Page 2 - Access World Forums Post #0 Refback 05-08-10 15:22
replicated & non-replicated tables - Page 2 - Access World Forums Post #0 Refback 05-08-10 03:00
Point of sale software - Access World Forums This thread Refback 05-07-10 05:37
Question Multiple FE connections - odd problem to solve. - Access World Forums Post #0 Refback 05-05-10 21:28
Point of sale software - Access World Forums This thread Refback 05-04-10 13:26
Question Optimizing form on load - Access World Forums Post #0 Refback 05-04-10 12:17
Question Export to Text File Error - Access World Forums Post #0 Refback 05-04-10 11:57
Question Export to Text File Error - Access World Forums Post #0 Refback 05-03-10 20:20
Killing locks and sessions in access - Access World Forums Post #0 Refback 05-03-10 15:16
How to link and display task based on user login - Access World Forums Post #0 Refback 05-03-10 14:25
Point of sale software - Access World Forums This thread Refback 05-03-10 12:01
Point of sale software - Access World Forums This thread Refback 05-03-10 05:40
Open different forms when in runtime - Access World Forums Post #0 Refback 05-03-10 05:21
Killing locks and sessions in access - Access World Forums Post #0 Refback 05-03-10 02:55
Point of sale software - Access World Forums This thread Refback 05-03-10 01:46
Question Export to Text File Error - Access World Forums Post #0 Refback 05-02-10 23:30
Question User level security - retrieving group membership - Access World Forums Post #0 Refback 05-01-10 23:39
Point of sale software - Access World Forums This thread Refback 05-01-10 18:49
Question User level security - retrieving group membership - Access World Forums Post #0 Refback 05-01-10 18:39
Sidebar menu flyout - Access World Forums Post #0 Refback 05-01-10 16:54
Sidebar menu flyout - Access World Forums Post #0 Refback 05-01-10 16:18
Open different forms when in runtime - Access World Forums Post #0 Refback 05-01-10 09:26
???? - jetutil.dll This thread Refback 04-30-10 10:03
belajar-access : Messages : 26142-26158 of 26582 Post #0 Refback 04-27-10 22:34
RE: [belajar-access] [Tanya] tal?Merubah Kotak Pesan (msgbox) Post #0 Refback 04-16-10 12:40
Re: [belajar-access] [Tanya] tal?Merubah Kotak Pesan (msgbox) Post #0 Refback 04-12-10 23:48