Wrox Programmer Forums
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 September 23rd, 2004, 06:03 PM
Authorized User
Join Date: Jul 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default function calls

I am trying to fix some VB code and I am a bit confused with the different ways of function calling.


Call appendClause ("[Run Date]", frm!cboTestNumber, pre, post, STRNG)


Call appendCause ("Purpose", frm!cboRunPurpose, pre, post, STRNG)

if you notice, one call has brackets and the second call does not???

what is the difference????


Old September 24th, 2004, 12:34 AM
Friend of Wrox
Join Date: Jul 2003
Posts: 128
Thanks: 0
Thanked 1 Time in 1 Post

In visual basic codes when you have a string/text with a space between
characters for the code to work you need [] before and after the string/text. Like in your example the Run Date doesn't need
a pair of brace when it is Run_Date.
I hope this helps.

Old September 24th, 2004, 06:54 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG

The brackets are used around a field name. For example, if you're using a DLOOKUP function then it'd look something like this:

strString = DLookUp("[strMyField]", "tblMyTable", "[lngRecNo] = " & _

The first quote is a field name of strMyField located in a table called tblMyTable. The second quote is the name of a table called tblMyTable in the database. The third quote is a field named called lngRecNo in the table called tblMyTable.

Generally for DLookUp, DCount, or in SELECT statements, [] denote a field name.

The other use is when a field name or control element in your form or report has a space in it (a no-no). For example, suppose you put a textbox on a form and called it My Text Box instead of MyTextBox. In VBA code, you'd refer to it like this

If IsNull(Me.[My Text Box]) Then

instead of

If IsNull(Me.MyTextBox) Then

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Old September 24th, 2004, 09:15 AM
Authorized User
Join Date: Jul 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks guys this helped...

Similar Threads
Thread Thread Starter Forum Replies Last Post
Nesting tags / function calls possible? Obsidian3d XSLT 4 March 30th, 2007 03:46 PM
servlet calls saxon Tomi XSLT 1 August 30th, 2006 06:35 AM
VB code that calls a function mikefemi Beginning VB 6 1 January 11th, 2006 06:12 AM
detecting calls while online arbe1988 Beginning VB 6 0 October 3rd, 2004 03:53 PM
XSL calls java function - prob vetrikam XSLT 2 October 9th, 2003 10:33 PM

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