If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Access > show vba variable in a form

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Oct 2002
Posts: 18
show vba variable in a form

How can I make a textbox on a form show a "public"-variable?
I made a code which generates de value of a variable (let's say "intTest". But now I want to show this variable on a form. I hoped that i could just refer to it by giving the name "intTest" at the properties of a textbox.

Thanks for your time
Reply With Quote
  #2 (permalink)  
Old
Registered User
 
Join Date: Nov 2002
Location: San Francisco
Posts: 251
Re: show vba variable in a form

you can have public variable... just define it out of any sub or function with PUBLIC word

e.g.

PUBLIC strMyText as string

then

if you have a let's say text box on the form and you want to put that value into in....

use me.txtMyText.Value = strMyText when you open the form or when you hit the button

the ther way is to use function, which returns the value

Public Function ReturnMyValue() As String
ReturnMyValue = strMystring
End Function

and use the function as data source for that field



jiri
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 On
Pingbacks are On
Refbacks are On