Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 13th, 2005, 12:01 PM
Registered User
 
Join Date: Oct 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default What does (Me!) and (Dim)stand for in VBA Coding?

I have Beginning Access 2003 VBA. I have not found what the purpose of using Me! of Dim is. What does thay stand for?

 
Old October 14th, 2005, 06:41 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Dim is a reserved word to reserve space for a variable in memory. You should set your database default for Option Explicit, which forces you to declare variables before you run a function, etc.

The syntax is:

Dim stVariable As ...

Where Dim is the declaration, stVariable is your variable name (usually with a prefix (st) that refers to the Type of variable you are declaring. In this case "As String".

When you declare a variable, space is reserved for the variable in memory and when the variable is used, Access VBA uses a short cut to the memory register, rather than creating the memory register on the fly in the middle of your code.

The Type of variable you declare determines what can be stored in the memory space, and how much memory is reserved for the variable.

You need to read up on this in one of the fine Wrox books on VBA.

Me! refers to the form or report running the particular sub or function you are in. So if you have a variable on a form you want to capture, like the value in a text box, you would declare the variable, and then grab the value from the text box like this:

Dim stValue As String

stValue = Me!txtMyTextBox

You can also refer to the form like this, instead of using Me!

stValue = Forms!frmMyForm!txtMyTextBox

That is the long way around that you would have to use in a function that you might be running from a module.

HTH


mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Does the p stand for php or perl ciderpunx BOOK: Professional LAMP ISBN: 0-7645-9723-X 2 October 27th, 2011 02:06 PM
Organization chart in Excel through VBA coding mangesh.gohad Excel VBA 0 July 26th, 2008 12:23 PM
Running the examples on a stand alone computer MustfaZfar BOOK: ASP.NET AJAX Programmer's Reference : with ASP.NET 2.0 or ASP.NET 3.5 ISBN: 978-0-470-10998-4 0 December 13th, 2007 01:49 PM
creating stand alone exe mr_bharathi General .NET 3 November 30th, 2004 08:35 AM
event coding - Access VBA bph Access VBA 5 January 6th, 2004 12:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.