Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Allow User to Change Default Value

Status
Not open for further replies.

number2

Technical User
Joined
Oct 25, 2001
Messages
284
Location
US
I have a memo feild which is given a default multiple sentance text value in my table.

I need to find a way for the end user to able to edit this default value. Can I code a button to change the default value when the user makes his changes and hits the button?

Thanks
 
If the memo field is a bound object on your form then just the act of changing the memo field object on the form and saving the record will make the change.

If the memo field is not a bound object on the form but you have populated it through code then the following will update the memo field through code from the OnClick of the button you suggested:

dim db as database
dim rs as recordset
set db = currentdb
set rs = db.openrecordset("tblYourTable", dbOpenDynaset)
rs.FindFirst "[RecordIDName] = " & me![RecordIDObject]
If Not rs.NoMatch then
rs.edit
rs("MemoFieldName") = me![formsMemoFieldName]
rs.update
else
MsgBox "No matching record found"
end if
rs.close
db.close

Does this help?

Bob Scriver
 
I think you understand my problem. As I am a novice with only a few years under my belt, I am however having difficulty identifying some of the variables like, MemoFieldName, RecordIDObject any aditional help?
Thanks
 
This code was what we call "Air" or "Pseudo" code. We place in it generic field names that are descriptive of the real names that only you the user can provide.

MemoFieldName is the name of the field in your table that is identified as your Memo field. This is what you want to update in the table.
tblYourTable is the name of your table where the records are stored.
RecordIDObject is the textbox name on your form that serves as the identifier of the record that you would like to update. It must be a unique identifier in that only one record in your table has this value.(i.e. Social Security #, Emp. ID#, Case#, Account#, etc.) You should have this field identified on your form so that you know which record you are working with.

If you describe your form in more detail and how you populate your records with data from one record to the next I can be more specific and help a great deal more.

Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top