99.3% Of all customers recommend us, we're so confident about our results we publish all reviews and statsView Live Stats View Reviews
Hints and tips home » Access hints and tips
Access hints and tips
When you have related tables such as Customers and their Orders, the Customer table is the Primary table.
Open the Customers table in datasheet view and go to the Home Tab and Records group. Click on the More option and choose Subdatasheet and then click on Subdatasheet again. Now choose the related table (Orders) and click ok.
Now you can click the + symbol by each company to show the related orders.
Create own ribbon tab - Access 2010
a. In Access click on the File tab
b. Select Options from left hand side
c. Choose the Customize Ribbon section
d. Click the New Tab button (below the list of tabs on the right hand side of the dialog box)
e. Select the New Tab (Custom) and enter a name, by clicking the Rename button (below the list of tabs on the right hand side of the dialog box)
f. Select the New Group (Custom) and enter a name, by clicking the Rename button (below the list of tabs on the right hand side of the dialog box)
g. Add commands to your tab and group by locating them on the list on the right hand side (remembering that you can change the list using the drop down box at the top of the list of commands) and clicking the Add button between the two panes to add them to your tab and group
h. You can rearrange the commands in your group, the groups on any tab or the tabs, using the up and down arrow buttons beside the list of tabs.
i. Click OK to apply your changes
Using the Quick Access Toolbar in Access 2010
The Quick Access Toolbar is included in virtually every Office product, including Outlook 2010, Word 2010, Excel 2010, and PowerPoint 2010.
You will find the Quick Access Toolbar in the top-left side of the window. To begin, click the Customize button (it's the little black arrow at the end of the toolbar).
Simply click the commands you want to include.
Virtually any command can be added to the Quick Access Toolbar. Click the More Commands option and a new window will open from where you can browse the commands including those not on the ribbon.
Duplicating an Entry
To duplicate the entry press CTRL+' (apostrophe)this will copy the contents of the previous entry in the same field.
(Table view, line above) note this also works in Excel.
An option when you open your Access database that contains all of you tables, forms and queries is only the switchboard is displayed.
To achieve this, select Tools click on Startup. On the right hand side of the Startup screen you are able to select which form you want to open when you open you Access Database. Once you have selected this, there is a check box just below that says "Display Database Window", you need to uncheck this option. Then click ok.
Then when you close you Access database and re open it, the database should open with just the switchboard being shown
Choosing data types in Access
Not sure which data type to use for your Access fields? Here are some guidelines to help you choose a data type to assign to a field.
- The Text data type can accept up to 255 characters. For information that will be recorded in paragraphs, use Memo.
- Also use Text for numbers that aren't going to be used in calculations, e.g. phone numbers.
- Use the Currency data type for monetary amounts.
- Use Date/Time for dates.
- Most other numbers can use the Number data type, but the Field Size property may have to be altered.
- For fields that have only two alternatives (yes, no) use Yes/No data type. If there is likely to be a third entry option (e.g. maybe or don't know) use Text instead.
Calculating The Difference Between Dates
If you wish to calculate the time between two date fields, this can be done in a number of ways:
1. As a calculated field in a query
2. As a calculated control in a form or report
3. As a calculation in a VBA procedure.
The basic syntax to get the number of days between two dates is:
=[One Date Field] - [Another Date Field]
You can also use one of the following functions:
=Month([One Date Field] - [Another Date Field])
which calculates the number of months between the two fields
=Year([One Date Field] - [Another Date Field])
which calculates the number of years between the two fields.
Another function is the DateDiff() function.
It uses an argument to determine how the time interval is measured. For example:
=DateDiff("q",[One Date Field] - [Another Date Field])
returns the number of quarters between the two fields.
Other intervals that can be used in this expression are as follows:
"yyyy" - Years
"m" - Months
"d" - Days
"w" - Weekdays
"ww" - Weeks
"h" - Hours
"n" - Minutes
"s" - Seconds
How To Display An '&' In A Label In A Form
To have your label display a sentence with an &(ampersand) in it, like Fox & Hound simply type it as:
Fox && Hound
Undo Entries In Records
To Undo any entries or changes in records:
Hit the ESC key once for the current field
And ESC twice for current record
Insert The Current Date
To insert the current date into a Table field or Form Text box use:
Insert The Current Time
To insert the current time into a Table field or Form textbox use:
Hide Access Tables
One method of stopping your Access tables appearing in Database window, is to rename the table(s) with the prefix usys.
This converts the table into a system object, which cannot be viewed in the Database window.
You can show system objects in the Database window by the following:
Step 1: On the Tools menu, click Options.
Step 2: Click the View tab.
Under Show, select the System Objects check box.
Hiding Multiple Table columns
If you want to hide non-adjacent Access table columns. In Datasheet view, open the table that contains the columns you want to hide.
On the Format menu, click Unhide Columns.
In the Unhide Columns dialog box, clear the check box next to the name of each column you want to hide.
This method makes having to use the Hide Columns command repeatedly unnecessary
Changing MS Programs Text Size
A handy way to increase or decrease the size of text in Microsoft Word, Microsoft PowerPoint, Microsoft FrontPage, or Microsoft Publisher, first, select the text you want to resize.
Then, to increase the font size, press CTRL+SHIFT+>.
To decrease the font size, press CTRL+SHIFT+<.
Copy a Previous Record's Values to a New Record
If you often enter the same value in one field of a table, there are two methods to save re-typing the data.
1. Use Ctrl+' (apostrophe) to repeat the value input in the previous record.
2. Change the field's DefaultValue property in Design View to the most commonly used value.
How To Find All Overdue Accounts?
To find overdue accounts create a filter that compares today's date with the Invoice Date in the table. To do this:
1. Open the Query in Design View
2. Select the field for the filter and in the criteria row enter:
This filter returns records where the Invoice Date is before today's date.
This filter can be manipulated if, for instance, Invoices are due 15 days after the Invoice Date. For this the filter would be:
This filter returns records where the Invoice Date is 15 days before today's date.
Create An Inaccessible Field On A Form
There is sometimes a need to make a field in a form look like a normal field but be completely inaccessible to the user. To do this:
In the Field's Properties
Set the ENABLED property to No
Set the LOCKED property to Yes
The field will not grey out, but the user will not be able to do anything with it.
Open A Combo Box Automatically
This is helpful if users need to enter large amounts of data. There are two ways to open ComboBoxes when they get the focus by using the tab keys.
When the ComboBox gets focus:
Press Alt + Down Arrow on the keyboard
For it to happen automatically, needs a bit of coding:
1. Add a combo box and a text box control to the form
2. Set the combo box's On Got Focus property to the following event procedure:
Private Sub ComboBoxName _GotFocus()
3. Open your form in Form View and use the TAB key to make sure it works.
Convert A Form Into A Report
If there is a form that you want to to save as a report:
1. Open that form in Design View
2. Select File and Save As
3. In the Save As Dialog box Select Report
The system creates a report based on the form.
Change The Default Font in Access 2003
You can change the default font in Access 2003 so that whenever you create a new database your preferred font is automatically set.
To change the default font:
1.From the menu bar select Tools.
3.Go to the Datasheet tab:
4.In the Default font section select your preferred font from the list of fonts e.g. Arial.
5.Select your preferred size from the size menu e.g. 12.
Click on the Tables/queries tab:
1.In the Query Design font section select your preferred font from the list of fonts e.g. Arial.
2.Select your preferred size from the size menu e.g. 12.
The default font for Access has now been changed.
Splittng a database
Split your database into two (at least).
Keep all of your code, forms, reports, etc. in one 'code' database and all of your tables in another 'data' database which is then linked to the 'code' database.
This makes modifications, updates and back-ups that much easier and allows you to work on a new version of your 'code' database without affecting existing users. It also makes it easier should you wish to convert a single user databases into a multi-user networked version.
Deleting duplicate records from a table
You cannot delete records tables where there duplicate records. A way around this is to create a new table which wont hold the duplicates. and then deleting the old table.
1. Use a make-table query based on this table only. IMPORTANT - Ensure that you include all of the fields from your original table or you may loose data.
2. Open the query's property sheet by using VIEW, QUERY, PROPERTIES, and set the Unique Values property to Yes
3. Because you have selected the Unique Values to Yes when you run the query, Access creates a new table without duplicate records. You can now delete the old table and rename the new one.
Hiding rows and columns
To hide a column or row in Access, you need to minimise the column or row. This can be done by placing your mouse on the right edge of a column, wait for the mouse to change to a double aroow and then drag to minimise the column
Closing form after a certain time period
To make a form close automatically after a certain time period, you need to assign the close function to a macro.
Save the macro and ope up the form in design view. open the Properties sheet.
In the TimerInterval property enter the length of time you want the form open for. This should be in milliseconds, so for instance if you want the form open for 5 seconds enter 5000, for an minute enter 60000.
You now need to attach your macro (to execute the Close action) to the OnTimer event property of the form.
If you have created a form / switchboard and dont want people to get away from using the switchboard, you can change the form properites for Modal to On.
Pop up property
If you want to focus the attention of a form / switchboard to a user then you can change the propeties of a form/switchboard for Pop up to On.
This meand tht the focus for the user must be on the form / switchboard
You can create percentage values based on individual products / items by using a Dsum function (used with a grouped query)
[Each value column] / Dsum[field:total for the column needed to be calculated],[tablename]
Data is th key to a good database, therefore checking is essential.
A good way of checking data is by random sampling. You can do this in a query, by typing the follow:
1) In the Field box create a RandonID field eg. Randon Id: Rnd(fieldname])
2) sort the field
3)Right click and chage the properties for To value to be the number of randon records you want to see.
4) Change the set to Show row for Randon ID to be False, add all the other fields you want to see and the run the query.
It is good practice not i to have space marks for field names as this can lead to problems when using queries or VBA code. It is much better to use an underscore charcter to represent spaces in field names
Unlike select queries you cannot use action queries as a data source for the use with forms or reports,as they do not return a dataset that can be read.
combo box for finding records
You can use a combo box in a form to look up a record. If you place the comb box in the Form header, by then selcting they a field type from the drop down loist, you will see the record for it
You can create a report in Access for printing labels All you have to do is is click New under the Reports object and then select Label Wizard and follow the steps
Creating Parameter wildcard queries
To creat a parameter query that also uses a wildcard, in the query design type in like +*.
Create calculated fields that work out your age
You can uset eh year function to work out the year from NOW function and then subtract it with your date of birth type field
To change case from upper or lower case, highlight the text area, hold down the Shift key and pres F3
Zoom feature for queries
If youare working on on query design and creating a calculated field, it can be hard to view the whole statement. You can hold the shift key down and press F2, to show the zoomed up version of the query field
remove spaces in a table
If you have a table that has too many space marks littered around, you can create a update query and use the trim function to get rid of any excess space marks
It is important to create proper relationships between tables. You can use Access to help check your designs and evaluate them by printing them in graphical format to help with design purposes
Click on the Tools menu, click Relationships.
On the File menu, click Print Relationships. View or print as required
Compact database automoatically
To ensure optimal performance, you should compact and repair your
Open the Access database or Access project that you want Access to compact automatically.
On the Tools menu, click Options.
Click the General tab.
Select the Compact on Close check box.
add date to a field
Add current time to a field
Press CTRL+SHIFT+ SEMICOLON
When using Date Type = Autonumber as a primary key, clients may require autonumbering to be prefixed with a letter.
For example, P001, where P is the prefixed letter
Step 1. Create Field Name
Step 2. Set Data Type to Autonumber
Step 3. Within Field Property General tabsheet,
enter Format property as [backslash]P000
Design View in Relationship window
Your in the Relationship window and changes are required to be made to a Table's design.
Rather than exiting the Relationship window, if you perform a right-mouse click on the table, it opens that table up in Design view
Display current date & time in column of any width
The worksheet function =NOW() returns the current date & time. When entered into a column which is not wide enough to display the value NOW returns, the cell displays ###
Create a custom Close button on a Form
By default, Forms that you create in Access have a full set of control buttons, that is, a title bar with Minimize, Maximize and Close buttons in the top right-hand corner and a Control Menu in the top left-hand corner.
Sometimes Access needs to follow certain procedures or events as users close a Form (such as automatically opening another Form perhaps). So it is often a good habit to create a custom Close button on a Form for everyone to use, rather than the standard closing cross.
To create a custom Close button:
1) In Form Design View, draw a Command Button onto the Form.
2) Use the Command Button Wizard to select Form Operations under Categories, and Close Form under Actions.
3) Choose Finish.
Access then creates the button and code to close the form for you. You can add any extra code that needs to run as the Form closes to the same Close procedure.
However, the creation of a custom Close button is pointless if the closing X in the top right-hand corner of the Form remains active. To make the closing X inactive, open the Form Properties box then on the Format tab set the Close Button setting to No. This will grey out the closing X leaving it visible, but inactive.
Run with the total
Often when creating reports with lists of transactions it can be useful to have a column which totals the transactions as the report progresses.
Using the Sum function gives the total for the whole group, not a running total.
Access provides an easy method of achieving a running total.
Click on the text box containing the data you wish to contain the running total.
Select the Data tab
Click in the Running sum option
Click the down arrow to view three options