Keeping a value in a textbox

  • Thread starter Thread starter Skip Bisconer
  • Start date Start date
S

Skip Bisconer

I am updating a table via a form using the table as the data source. I can't
seem to get what I want to work. I have an OrderNo, RouteID and
DeliverySequence field.
The RouteID and DeliverySequence are the fields I need to put data in. They
are blank in the table until they get assigned through the form.
Basic procedure is call up an OrderNo. Assign a RouteID(Text A-Z) and
DeliverySequence (Numeric 1 - many). I have 35 to 40 orders to assign this
information to. I want the RouteID to maintain the value until I change it to
another RouteID. Right now as soon as I update and call the next record the
value is blank for obvious reasons. I am also trying to get the seqence
number to advance by 1 from the previous data update. Any suggestions would
be greatly appreciated.
 
Skip,

The way I do it is to store the values in the Registry.

When you want to store a value, use the following construct:
SaveSetting "myApplicationName", "Settings", "DefaultWhatever",
Cstr(Me!txtMyTextbox)

Make sure to change "myApplicationName" to the name of your application,
"DefaultWhatever" to the name of the field/control whose value you're
storing, and "txtMyTextbox" to the name of the control containing the actual
value you want to store.

Then when you want to retrieve your value:
Dim varMyValue As Variant
varMyValue = GetSetting("myApplicationName", "Settings",
"DefaultWhatever", someDefaultValue)
Me!txtMyTextbox = varMyValue

Using this construct, you can test varMyValue, and if empty, you can put
Null (or whatever you like) into txtMyTextbox.

Don't forget to also store empty strings when needed.

Check out Help for SaveSetting, GetSetting, and GetAllSettings.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Back
Top