Saving the value of a label

Matkins
02-03-2005, 01:43 PM
OK, sorry for posting this here, but it really is a vb question. I am using access for a database, and i have a form, that has a piece of code, that whatever i type in a textbox, changes the label i have to that word upon pressing a button.
Although it updates the value of the labels caption, this is useless as it loses that data once the form is closed. i thought of using some sort of cmd, and i found cmdsave. After trying with this for ages, i realised that the save button does not save the labels caption, and that it is only in design view that you can save a new caption. i sound a bit incoherrent, but i hope u get what i am saying.
so what i need is a way of saving a labels caption to the form after i have changed it with code
if its any help here is the code, they r mainly variables.

Dim PasswordFormName As String
PasswordFormName = "Password Changer"
Private Sub PassChange_Click()
Password_Hide.Caption = NewPass
DoCmd.Save acForm, PasswordFormName
End Sub

bhaspect
02-03-2005, 02:57 PM
I would just save the info to a file then read the file upon load of the program. ;)

Matkins
02-03-2005, 03:34 PM
LOL. Thats what i did the first time round, and it all worked perfect except for one little thing, and i couldnt solve it, so i decided to try this method. Ok, i have one more method to try, of saving the text to a table and reading it from there. Unless anyone else has any ideas?

NEOLLE
02-03-2005, 06:07 PM
You can use your Database, aside from using a TextFile. :)

Matkins
02-08-2005, 02:18 AM
ok, does anyone know how to read a specific field record from a table, ie the second row down, third field along. I guess i dont need multiple fields, so just being able to read a value from a table with one field would do.

any help?

inter
02-08-2005, 04:04 AM
ok, does anyone know how to read a specific field record from a table, ie the second row down, third field along. I guess i dont need multiple fields, so just being able to read a value from a table with one field would do.

any help?

sollution i'm giving is good if you're not looking for recordnumber 54123156 or something....

"select * from yourtable"

for i = 1 to 3
if yourrecordset.eof = false
yourrecordset.movenext
end if
next i

now you have selected your 3rd row in your table

sambase
02-08-2005, 04:06 AM
run an sql statement to select the record you want...

For this you could make a record with a field called "ID".
In this field put the value "1".
Then run an SQL query :

"SELECT * FROM NameOfYourTable WHERE ID = 1"


then to select a specific field:


myRecSet.Fields.Item("Field").Value


Where "Field" is the name of the field where u stored the value you need to retrieve.

Regards

Sam

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum