Google Plus
Saturday, August 6th, 2011 |Today I added the Google Button Plus +1. This is another way to advertise the posts. If you have not invited to Google Plus leave a comment with your email address to send the invitation.
Learning to work with Access
Today I added the Google Button Plus +1. This is another way to advertise the posts. If you have not invited to Google Plus leave a comment with your email address to send the invitation.
This is a very simple database that serves to control the expenses of everyday life.
Main Menu
In the picture one can see the main menu very simple and functional. At the top we can see the year in which we work. 
Year of work
To change the year's work click the button to choose the year and open form (Fig. 2), typing the year we want. 
Expenditure
Expenditure on the button open form (Fig. 3) for data entry. Next to the category we have a '+' button to add categories and subcategories have one side of the '+' button to add the subcategories (by clicking on the subcategories if you have not chosen cetegoria gives error and asks to select the category . If you have selected the category it opens the form categories in the selected category).
In the field we can choose a provider from the list and if there is he asks if you want to add. 
Categories
This form (figure 4) is used to manage (insert / change / delete / search) categories and their subcategories. 
Suppliers
This form is used to manage (insert / change / delete / search) the names of suppliers. 
Reports
Clicking this button opens the menu (image 5) reports where we can choose four types of reports: 
- Costs of the current year (Fig. 6) shows a report with the category, subcategory, and total value per month of the year with which we work. It also shows the total expenses per month and total by subcategory.
This report includes a chart for subcategory that shows the monthly evolution of each subcategory. This graph is not of my own, the respective module has the author's information, including:
'Author: Philippe Bonnardel (based on an idea of Edward Tufte)

- Costs per year (picture 7): shows a form with the expenses by category in a given year. We can choose the year of expenditure, provided that there is an expense recorded in that year to view the graph. When you double-click the category opens the annual report of subcategories that has the same format. When you double-click opens the detail in the subcategory (Fig. 8) the costs incurred in this subcategory.

Detail 
- Expenditure per month: equal to the expenditure per year but here we can choose the year and month you desire.
- Expenditure by supplier shows a form with the cost per supplier in a given year, and its graph. In this report we can only choose the year you wish to view.
Annual Comparison
Shows the evolution of expenditure during the last 10 years. Shows the values for years and shows a graph. 
I await comments of this database, however I will add functionality to the example as the ability to print reports.
Download the example: EXPENSES
This updating of the sales changes were as follows:
Putting the company's image in the report, which was not displayed.
Recasting the printing aspect of the sale and placement of the "product" that was not in print.
Placing the table IVa and totals.
Creation of the form listing daily sales where we can see all the sales on the day and a listing by type of payment.
Changing the code to insert the image of the company logo. Because the image is linked to the 'localfoto' which is the path on disk where the image if the image is not on the local error and could not open the form "enterprise data". So I put a routine that checks error occurs and if so hides the image and exits the function not to give error. Basically back to the initial state as if it had not image.
Changed in form and print the report of the sale.
Suppliers - the form was created for suppliers. Whenever you enter a new purchase and the supplier does not exist, asks if you want to add. If so open the form "Suppliers" to enter the data.
Shopping - If the articles do not exist, asks if you want to insert.
Download: Sales System
Thank you to test and comment, to improve the system.
In the case of shelter animals and such sales system has a form where we can put a photo. After using this code I found that as the image is linked to the 'localfoto' which is the path on disk where the image if the image is not on the local error and could not open the form. So I put a routine that checks error occurs and if so hides the image and exits the function not to give error. Basically back to the initial state as if it had not image.
In the next post I'll put the next update of sales system where we can see the working code. However we can do a test that is to put the sales system in a different folder and see what happens when we open the form of company data.
The code is updated as follows:
'Www.accessexemplos.com
'Jose Martins
'2011-02-28
On Error GoTo Err_mostraimagem
If IsNull (Me.Localfoto) = False Then
Me.FOTO.Picture = Me.Localfoto
FOTO.Visible = True
SEMFOTO.Visible = False
Else
Me.FOTO.Picture = ""
SEMFOTO.Visible = True
FOTO.Visible = False
End If
Exit_mostraimagem:
Exit Sub
Err_mostraimagem:
Select Case Err.Number
Case 2220 'Do not see the image
FOTO.Visible = False
SEMFOTO.Visible = True
Resume Exit_mostraimagem:
Case Else 'Other Error.
MsgBox Err.Number & "" & Err.Description
Resume Exit_mostraimagem:
End Select
For a user when entering data always write in capitals just put the following code in the field properties in the event 'when you press' (OnKeyPress):
KeyAscii = Asc (UCase (Chr (KeyAscii)))
where KeyAscii will receive a new ASCII code
chr = displays the ASCII character code
Function 'asc': Returns an integer that represents the code (ASCII) character corresponding to the first letter in a string.
UCase Function: converts a string to uppercase.
Chr function: it shows the character of the ASCII code
To convert to lowercase just change UCase LCase by:
KeyAscii = Asc (LCase (Chr (KeyAscii)))
I've noticed that some readers send the same message several times, because they think that the first was not submitted successfully.
If it is the first time to comment, this message has to be approved, which also approves as fit to comment.
This is a protection against SPAM, not messages appear to have nothing to do with the blog.
So after sending the first message, just have to wait until it is approved and thereafter the next messages now appear automatically.
Still blacked out 252 spam messages ...
As was said in previous message, I changed the location where the files to download.
From now housed in the service of BOX.NET , where at least no longer have to wait for the download and has no advertising.
You still have to update some links, which next week will be completed. Also put a link in the menu of the blog "DOWNLOADS" which connects to the folder on BOX.NET where all the files available for download.
Any questions or find that file changed, thank you to inform me.
Today I'll demonstrate how to create a menu bar, step by step, to give a more professional and just give access to options that really matter to the end user of a project in Access.
At the end we will have a menu bar that looks like the image below.

1 - Go to the Tools menu and choose 'customize'. The following menu appears:

2 - Choose the tab 'Toolbars' and choose 'New' and enter the name you want to give to the toolbar, I chose "menu". Click OK and appears on the toolbar which will work, which for now has no options.
3 - With the selected toolbar click 'properties' and the following menu appears:

4 - Change the 'Type' to 'Toolbar' and then click Close.
5 - Click on the 'commands' and the list on the left that says 'categories' choose 'new menu' which should be in last position. Then click the box on the right 'commands' and drag 'new menu' up on our menu bar as exemplified by the image below.

Drag 'new menu' up on our menu bar, the times required by the number of menus that we need in this example I will drag three times to make two menus and submenus. To make a submenu simply drag 'new menu into a menu. Note: The number of menus can be changed later, you can add or decrease by as you need.
6 - Clicking the right button of mouse on top of 'new menu' of our toolbar and change the name as desired. In the example I chose 'Customers' for the 1st and 'suppliers' for the 2nd.
7 - Now let's put menus in forms that we intend to open. Click on the 'Commands' and choose the category 'All forms' and on the right side will show all existing form in the current project. Click the form you want and drag the tool bar. In the example I chose various forms and reports and also the option EXIT (to close Access). At this stage we can choose what we want our toolbar open you just have to choose what we want in the categories (tables, forms, reports, queries, Access action menus that appear as the menu bar by default, etc.).
8 - After choosing everything you want to have on our menu bar you can click on each one with the right mouse button to see the properties that can change. See the image below.

'Reset' - serves to put an item was originally before you change the name of the image, etc..
'Delete' - delete a menu item
'Name' - to change the name of the menu item. Here we can also set the shortcut to that item using the ampersand before the letter you want to use as a shortcut. For example, the Exit option by default is already well & xit the menu appears the letter 'r' underlined that tells us that when using the ALT key + r runs the Exit menu item. In the example I chose to open Clients & Client with the shortcut ALT + C.
'Copy / paste / reset / edit / change the button image' - these commands are used to work exactly the image we want to see next to each item. We can copy and paste the image to use in another item, restore the original image, edit the image and make an icon editor (pixel by pixel) or choose a picture available on the menu change.
Then we can also choose the aspect of the item, ie if we want text only or text and image.
'Start a group "- serves to separate items by a horizontal bar, or create groups of items.
"Link grant" - to assign a link to either a URL or any object in the database.
'Properties' - shows all the properties of the item.
9 - Now that we have the menu bar we have ready to put in place. To do this click on the close button and drag our menu to the top of the screen until you paste it to where the bar is the default Access.
10 - To start the bar to open the database have to give the instruction to open when you start Access. Let the 'Tools' and 'Start' and 'Menu Bar' choose the name of our menu in this example 'menu'.
11 - To change the images of each menu items we can use another way is to insert an image into the same form and copy for the item. That is:
- Create a form in the form of structure
- Go to the Insert menu and choose the image
- Choose any image and hit enter
- Select the image and with the right mouse button choose Copy
- Go to the Tools menu and choose the option to customize
- Click the right button of mouse on the item you wish to change the image and choose Paste Button Image.
- Click close and close Access
- Start the database to see the outcome
IMPORTANT NOTE: When changing the menu bar, the menu disappear in the Access database, it is done. To make changes in it is necessary to start the database down the SHIFT key.
My menu looks like this:

Download: Menu Bar
We can prevent a report open if no data to show, and for this we use two forms depending on the version of Access:
1 - All versions of ACCESS
Place the code below in the properties of the report, the event 'Enabling'
Use the event Enabling (Activate) Report:
Private Sub Report_Activate ()
If DCount ("*", Me.RecordSource) = 0 Then
MsgBox "No records to display" vbDefaultButton1, "Error!"
AcReport DoCmd.Close, "report name"
End If
End Sub
2 - From version 7 (Access 95) was added the event 'if no data', then we can urilizar the following code:
Private Sub Report_NoData (Cancel As Integer)
MsgBox "No data in the report.", VbInformation, "Error!"
Cancel = True
End Sub
To see running download the example: Prevent opening report