423,822 Members | 1,356 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,822 IT Pros & Developers. It's quick & easy.

Changing and storing the value in a text box without adding row to table

P: n/a
MS
What's the best way to "store" and display a value in a text box that
changes from day to day. An example of this would be where the name of the
user is manually typed in after using the datbase, along with (say) the
date.

ATM, I have a table with (say) 4 fields. Each field is linked to a column in
a combo box. The combo box is invisible on the form. The text boxes display
previous data using code something like this...

Private Sub Form_Current()

Me.TxtSR = Me.CmbDt.Column(0, 0)
Me.TxtMS = Me.CmbDt.Column(1, 0)
Me.TxtSRCart = Me.CmbDt.Column(2, 0)
Me.TxtMSCart = Me.CmbDt.Column(3, 0)

End Sub

The combo's table is then updated with something like this when new data is
typed in the text box....

Private Sub TxtMS_AfterUpdate()
Dim rstx As Recordset
Dim Dbx As Database

Set Dbx = CurrentDb
Set rstx = Dbx.OpenRecordset("TbleEnt", dbOpenDynaset)
rstx.MoveFirst
With rstx
.Edit
!EntMs = Me.TxtMS
.Update
End With
rstx.Close
Set Dbx = Nothing
End Sub

Each text box has this code.

Is there a better, more direct way to do this? Its the only way I've thought
of "changing" and storing the value of a text box without adding a row to
the table.

This is in A97

Cheers!

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Do you mean something like a setting? that might change but normally
doesn't

Then you could use ini files or the registry.

Nov 13 '05 #2

P: n/a
MS

"Cable" <cb****@gmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
Do you mean something like a setting? that might change but normally
doesn't

Then you could use ini files or the registry.


No, just the data that the field is storing.

Say a text box that has the name of the user who last accessed the DB. It's
easy to link the text box to a table, but that situation in it's simplest
form adds a row each time the field is changed - i.e. a new record.
Nov 13 '05 #3

P: n/a
MS wrote:
"Cable" <cb****@gmail.com> wrote in message
news:11*********************@l41g2000cwc.googlegro ups.com...
Do you mean something like a setting? that might change but normally
doesn't

Then you could use ini files or the registry.


No, just the data that the field is storing.

Say a text box that has the name of the user who last accessed the
DB. It's easy to link the text box to a table, but that situation in
it's simplest form adds a row each time the field is changed - i.e. a
new record.


No it doesn't. At least not unless you are doing something to make that
happen.

By default a bound form will open to the first record in the underlying
table. If you edit a bound TextBox you will be changing the data in that
row, not adding a new row.

Is the DataEntry property of your form set to Yes perhaps. That will cause
it to open to the new record position each time in which case editing the
TextBox would add a new record to the table.

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.