Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 18th, 2003, 01:20 PM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to reference Public Variable in Code

I know I can direct use Public Variable in code, but sometime I wish to use variable to reference it. Such as:

**Define Public Variable in Module

Public strA1 as string
Public strA2 as string
....
Public strA10 as string

***In Form VBA code, I wish can use For..Next loop command to reference Public variable, such as:

For i = 1 to 10
   strAAA = strAAA & PublicVariable("strA" & i) <--- Sorry, I don't know how to do it in code..
Next i


:)Do anyone can help me? Thanks a lot...





Best Regards,
Gino Liu at CI.
Reply With Quote
  #2 (permalink)  
Old June 18th, 2003, 01:40 PM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use an Array instead

Public strA(10)as string

***In Form VBA code, I wish can use For..Next loop command to reference Public variable, such as:

For i = 1 to 10
     strAAA = strAAA & strA(1)
Next i
Reply With Quote
  #3 (permalink)  
Old June 18th, 2003, 01:42 PM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Error in code updated.

Use an Array instead

Public strA(10)as string

***In Form VBA code, I wish can use For..Next loop command to reference Public variable, such as:

For i = 1 to 10
strAAA = strAAA & strA(1) <=== i not 1 here.
Next i
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use a run time variable as public Subuana Beginning VB 6 2 May 1st, 2006 03:27 PM
Passing Public Variables in Code-Behind striker9 ASP.NET 2.0 Basics 7 February 11th, 2006 03:54 PM
Can an object reference be public? maxpotters Excel VBA 2 March 6th, 2005 01:22 PM
difference b/w shared and public variable lgeetha VS.NET 2002/2003 1 March 4th, 2005 08:24 AM
Passing variable to a public variable Hudson40 Access VBA 2 February 25th, 2005 06:23 AM



All times are GMT -4. The time now is 03:29 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.