Re: PLEASE HELP....Post code

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



you're welcome ;) please post the code you are using with your modifications

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



kbrad28 via AccessMonster.com wrote:
Ok, I tried changing the control name of RecipeName on the report and I am
still getting the compile error, so I have no idea what I am doing, but
thanks for your suggestions.

strive4peace wrote:
"I am getting an compile error at the RecipeName_ControlName"

You have to substitute the NAME property of your control in here...

************ Properties and Methods ************

Just like in the real world, every object has properties and methods.

Properties are like adjectives that describe an object

Methods are like verbs and define actions an object can do

For instance, you are a human and have properties such as hair color, eye color, height, weight, ... and methods such as eat, walk, run, jump, ... make babies -- Add to a collection :)

If you become familiar with the different types of objects that Access can use and the properties that define them and the methods they can do (and what triggers them), you will be on your way!

In the design view, you can show the property ***, which will show information for the selected item(s).

~~~~ turn on Properties window ~~~~

When you are in the design view, turn on/off the Properties window -->

1. from menu: View, Properties
OR
2. right-click and choose Properties from the shortcut menu

and then click on various objects. The properties window changes as you change what is selected. If you have multiple objects selected, the values for the properties they have in common will be displayed

Try it!

~~~~ setting Properties vs. resizing with handles ~~~~

I like to make the width of controls exact -- like 0.25, 0.3, 0.4, 0.5, 0.6, 0.75, 1, 1.25, etc

This is especially handing for lining up labels to controls under them

~~~~ selecting objects ~~~~

you can select multiple controls
1. click and drag the mouse and everything your imaginary rectangle touches before you let go will be selected
OR
2. click, shift-click, etc
shift-click actually toggles the select status without affecting the other items selected
OR
3. click (optionally, and drag) in a ruler
while the mouse is down, you will see a line extend across (vertical ruler) or down (horizontal ruler)
if you click and drag, the ruler will turn dark indicating where you started and stopped
-- everything the line/rectangle touches will be selected
OR
4. drop down the objects combo (left-most control on design toolbar) and select something by its name

~~~~ select Form or Report ~~~~

To select the form (or report), you may:

1. click in the upper left corner where the rulers intersect
OR
2. click completely outside the design area in the dark gray space
OR
3. press CTRL-R
OR
4. from menu: Edit, Select Form/Report

~~~~ building event code ~~~

To build an event, click in the property *** for the appropriate object in the appropriate location and then click the builder (...) button off to the right

Access will provide the procedure declaration and the procedure end -- you put the lines in between.

~~~~ Name property ~~~~

Procedures are NAMED according to the object name (except the form object), so ALWAYS change the NAME property of any object to something logical. For example, if you have a command button named cmdClose, its event procedure may be something like this:

Private Sub cmdClose _Click()
If Me.Dirty Then Me.Dirty = False
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub

When the properties window is displayed and only one thing is selected, the Name appears in the title bar of the Properties window

If multiple items are selected, you will see "Multiple Selection" on the title bar.

~~~~ ControlSource, SourceObject ~~~~

It is important to realize that the Name is NOT what is displayed in a control. If the control is (for instance a textbox or combo box), you will see the ControlSource displayed.

If the object is (for instance) a subform or subreport, what you see displayed is the SourceObject

For bound objects, I like to make the Name property match the source property (this does not, by the way, follow naming conventions, but for me, it eases confusion)

As always, avoid using spaces and special characters when naming objects -- use the underscore character _ to separate and use mixed case for readability

~~~~ Recordset Property ~~~~

from the design view of a report or form:
turn on Properties
(from menu: View, Properties)

select the report or form
(click in the upper left where the rulers intersect)

click on the Data tab in Properties window

there you will see the RecordSet property
once you click in the property, you will see the builder button ... to the right

If your report is based on a query, this takes you to the query design screen

If your report is based on a SQL statement, you can modify it like the design view of a query (you can also press SHIFT-F2 to use the Zoom Box to change the SQL)

If your report is based on a table, you will be asked if you want to make a query

~~~~ Builder Button ~~~~

The RowSource property for a combo or list box is like the RecordSource property for a form or report -- you are choosing where the data will come from that is displayed. The Builder Button ... will be displayed when you click IN the property.

For choosing colors that are not on the color palette (like ForeColor, BackColor, Bordercolor), click the builder button. Once in the palette dialog box, click "Define Custom Colors" -- the dialog box will expand and you can set the amounts for Red/Green/Blue or adjust Hue/Saturation/Luminosity. There is also a slider control with a triangle you can drag up or down to change the Luminosity (brightness). I like to drag it up and fade out colors, especially for BackColor.

~~~~ Events ~~~~

"Properties" listed on the Events tab are actually methods ... such as OnCurrent for form, AfterUpdate for Control, etc

~~~~ Learning Properties and Methods ~~~~

Explore the property ***. Get familiar with how properties are grouped on the tabs and the different properties for different objects.

~~~~ Help on Properties and Methods ~~~~

You can get help about any property by pressing F1 while in a property on the property *** where you want more information.

~~~~ Object Browser ~~~~

... find out more about references... or just get Help!

in a code window to View the Object Browser:
1. from the menu --> View, Object Browser
OR
2. Press F2

On the left, you will probably see a Project window and a Properties window below it
On the right, you will see the main Object Browser window

as you select a Class on the left, its members will appear in the pane on the right

when you see something you want help on, press the F1 key and switch to the Help window

When you are getting started, change the library to "VBA" (for instance, instead of <all libraries>) and look at the classes (categories) of functions -- click on a class and then click on a function in the right pane. To get the help for that function, press F1

The VBA library is the most basic library and a great place to start exploring.

To look up properties and methods for different objects like forms, tabledefs, etc, change the library to Access
To look up ranges and sheets, change the library to Excel

explore the different libraries you have to pick from and see what is available in each
(these are added or removed using Tools, References...)

when you are in the Object Browser window, the library that each function/class is a member of is shown in the lower left corner of the window

when you have an object selected, press F1 to get help.

~~~~ general help ~~~~

For general help, I find it interesting and informative to read the help starting from the beginning of the Contents. In fact, if you have the desire to print a ream of paper, it would be good to print it like a book and read it so you can also take notes -- and you can read it away from the computer -- a good time to put new information into your head is just before you sleep ... let your subconscious figure it out!

Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*

Hi Crystal,

[quoted text clipped - 31 lines]
End Sub

.


Quantcast