A Microsoft Office (Excel, Word) forum. OfficeFrustration

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   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Use Tag property to load a string into a Text Box



 
 
Thread Tools Display Modes
  #1  
Old December 15th, 2004, 03:39 AM
Bradley C. Hammerstrom
external usenet poster
 
Posts: n/a
Default Use Tag property to load a string into a Text Box

A2K,

Here's a simple one I can't get to work.

On a form, the cmdBrowse button displays the chosen destination folder path
in txtFolderName. The user then clicks cmdGO button to call a function that
uses the path in txtFolderName. The user then closes the form.

I want the same folder path to appear next time the form is opened, so the
user doesn't have to Browse again.

I tried a line of code in the On_Click event of cmdGO that stores the string
in the Tag, like:

cmdOK.tag = txtFolderName

Then a line in the Load event for the Form to paste the Tag, like:

txtFolderName = cmdOK.tag

The string correctly appears in the cmdOK Tag line in the Properties box,
but when I open the form again the txtFolderName box is blank. What's going
wrong?

Brad H.


  #2  
Old December 15th, 2004, 07:02 AM
John Nurick
external usenet poster
 
Posts: n/a
Default

Hi Bradley,

Run-time changes to forms are not saved. Better to store "user settings"
like this in a table where data's meant to be keptg.

Set up a little table along these lines:

tblSettings
SettingName - Text (32 charcters max) - Primary key
SettingValue - Text (255)

and create a record with SettingName = "DefaultOutputFolder" or some
such.

Then store the new value with something like

DBEngine(0)(0).Execute "UPDATE tblSettings SET SettingValue=""" _
& Me.txtFolderName.Value _
& """ WHERE SettingName=""DefaultOutputFolder"";"

and retrieve it with something like
Me.txtFOlderName.Value = DLookup("SettingValue", tblSettings, _
"SettingName=""DefaultOutputFolder""")

On Tue, 14 Dec 2004 19:39:00 -0800, "Bradley C. Hammerstrom"
bhammerstrom @ NOTTYSPAMrhadcock.com wrote:

A2K,

Here's a simple one I can't get to work.

On a form, the cmdBrowse button displays the chosen destination folder path
in txtFolderName. The user then clicks cmdGO button to call a function that
uses the path in txtFolderName. The user then closes the form.

I want the same folder path to appear next time the form is opened, so the
user doesn't have to Browse again.

I tried a line of code in the On_Click event of cmdGO that stores the string
in the Tag, like:

cmdOK.tag = txtFolderName

Then a line in the Load event for the Form to paste the Tag, like:

txtFolderName = cmdOK.tag

The string correctly appears in the cmdOK Tag line in the Properties box,
but when I open the form again the txtFolderName box is blank. What's going
wrong?

Brad H.


--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
What if the back-end "moves"? John S. Ford, MD General Discussion 13 November 15th, 2004 09:33 PM
Finding Text String Within A String With A Formula Sandi General Discussion 5 August 17th, 2004 08:39 PM
scrolling programmatically? alekm New Users 1 July 6th, 2004 02:56 AM
adding a space to a text string [email protected] Worksheet Functions 1 February 19th, 2004 05:06 PM


All times are GMT +1. The time now is 03:00 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.