Save text field directly to table.

Niniel

Registered User.
Local time
Today, 17:14
Joined
Sep 28, 2006
Messages
191
Hello,

How can I save an unbound text field directly to a specific record in a table?
I can specify the right record via recordID and questionID. The field I want to save to is called "Note".

Right now I am moving the content of the unbound text field [located on the parent form] to a hidden text field on a continuous subform that is based on the table that is to store the information [which is not the table the parent form is based on], so it is saved that way.
The problem with that approach is that the right record has to be the current record on the continuous subform for the text to be saved in the correct place. If somebody were to edit only the text field later, the information will end up in the wrong place.

I can read the record into my text field
Me.Parent.NoteText = DLookup("[Note]", "tblActivityAnswers", "[ActivityID] = " & Me.Parent.[ActivityID] & " AND [QuestionID] = 12")
but don't know how to write to it.

Any suggestions?

Thank you.
 
Ado

You could always use ADO to create a recordset object of the table you want to modify. A recordset is like a virtual copy of the table that you can easily manipulate with code and then update the changes to the actual table. ADO also has a command object that you could use for this task. ADO is a fairly comprehensive subject and there is plenty of help for it available on this forum, MSDN, and the internet.
 
Thank you for your suggestion.

I shall take a look and see how difficult it is.
Somebody else mentioned that an update query may work, so I'll try that as well. Which of those methods would be better?
 
Go with the update query

If you can make the update query work for you, it should be faster and easier than using ADO.
 

Users who are viewing this thread

Back
Top Bottom