By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 663 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

Unbound TextBox assignment to a Record OnClose

P: n/a
I have a Single form with its RecordSource set to one table.
This form will have only one record that is used for the application
setup.

I have UnBound TextBoxes on the form. The textboxes will get filled,
and I want to have this data saved to the single record of the Table
using the OnClosed event.

The problem is that I get the error "You can't assign a value to this
object". The code below works fine when placed under a button. I
have the impression that the OnClose event may be too late for the
value assignment? How do I make the assignment??? Can this be done
without making DAO references?

Private Sub Form_Close()
Me.FIELD1 = EncryptDecrypt(Me.txtBox1)
Me.FIELD2 = EncryptDecrypt(Me.txtBox2)
End Sub

Mar 9 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I also tried the OnUnload event and this seems to work. The data goes
to the Table, but when I switch over to design view, the same error
message is showing with the code highlighted in the OnUnload event???

Mar 9 '07 #2

P: n/a
On Mar 9, 3:06 pm, "ApexD...@gmail.com" <ApexD...@gmail.comwrote:
I also tried the OnUnload event and this seems to work. The data goes
to the Table, but when I switch over to design view, the same error
message is showing with the code highlighted in the OnUnload event???
If you're intention is to display an encrypted field, then I would
make the changes to the bound fields when the unbound ones change.
In the AfterUpdate of the txtbox controls

Me!BoundControl = EncryptDecrypt(Me.txtBoxX)

Make the bound ones hidden.
When the record is updated, the bound controls already have their
needed values. No need to do it when the form closes.

Likewise, when you load the record set the value of the unbound
controls based on the bound ones.

Mar 10 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.