What control for retaining last entered data

L

Lorinda

Hi, I have a very simple form created that only captures 9
fields of data, then a control to save the record and then
start a new record. I'd like to retain the last entered
date (it's a drop down text box I believe)to use with the
new record. So I would like the date to stay the same
until I change it. Can you set a Default Value for that
somehow? I am so lost...
 
K

Ken Snell [MVP]

Use the AfterUpdate event of the combo box to set the default value:

Private Sub cboBoxName_AfterUpdate()
Me.cboBoxName.DefaultValue = """" & _
Me.cboBoxName.Value & """"
End Sub
 
L

Lorinda

Thanks, I am lost enough though, that I don't know how to
apply what you've sent me...if you have time I'd love more
help, but I'm slogging through the dummy book and help
function and surely will find something...thanks, maybe
this will make sense later~
 
K

Ken Snell [MVP]

Open the form in design view. Click on the combo box control. Open the
Properties window (icon on toolbar). Click on Event tab. In the box next to
After Update property, select [Event Procedure]. Then click on the box at
far right that has three dots in it. If asked, choose Code Builder from
popup window.

The Visual Basic Editor will open and display (my generic name will be
replaced by real name of combo box):

Private Sub cboBoxName_AfterUpdate()

End Sub


Cursor will be in the blank line between the two lines. Type the following
(using real name of the combo box, not my generic name) on that line:
 
K

Ken Snell [MVP]

(hit enter key wrong way!)

Open the form in design view. Click on the combo box control. Open the
Properties window (icon on toolbar). Click on Event tab. In the box next to
After Update property, select [Event Procedure]. Then click on the box at
far right that has three dots in it. If asked, choose Code Builder from
popup window.

The Visual Basic Editor will open and display (my generic name will be
replaced by real name of combo box):

Private Sub cboBoxName_AfterUpdate()

End Sub


Cursor will be in the blank line between the two lines. Type the following
(using real name of the combo box, not my generic name) on that line (all
one line even if newsreader wraps it):

Me.cboBoxName.DefaultValue = """" & Me.cboBoxName.Value & """"

Go back to the form's design view. Save the form. Close it.

Now, the combo box will use the last entered value while the form is open as
the default value of the next new record.
 
L

Lorinda

Oh my word, that is so great :) I know it has to be old
hat for you, but that it was this easy and that it worked
is soooo wonderful on my end!!! Thank you so much :)
-----Original Message-----
(hit enter key wrong way!)

Open the form in design view. Click on the combo box control. Open the
Properties window (icon on toolbar). Click on Event tab. In the box next to
After Update property, select [Event Procedure]. Then click on the box at
far right that has three dots in it. If asked, choose Code Builder from
popup window.

The Visual Basic Editor will open and display (my generic name will be
replaced by real name of combo box):

Private Sub cboBoxName_AfterUpdate()

End Sub


Cursor will be in the blank line between the two lines. Type the following
(using real name of the combo box, not my generic name) on that line (all
one line even if newsreader wraps it):

Me.cboBoxName.DefaultValue = """" & Me.cboBoxName.Value & """"

Go back to the form's design view. Save the form. Close it.

Now, the combo box will use the last entered value while the form is open as
the default value of the next new record.

--

Ken Snell
<MS ACCESS MVP>

Thanks, I am lost enough though, that I don't know how to
apply what you've sent me...if you have time I'd love more
help, but I'm slogging through the dummy book and help
function and surely will find something...thanks, maybe
this will make sense later~


.
 
K

Ken Snell [MVP]

You're welcome!

--

Ken Snell
<MS ACCESS MVP>

Lorinda said:
Oh my word, that is so great :) I know it has to be old
hat for you, but that it was this easy and that it worked
is soooo wonderful on my end!!! Thank you so much :)
-----Original Message-----
(hit enter key wrong way!)

Open the form in design view. Click on the combo box control. Open the
Properties window (icon on toolbar). Click on Event tab. In the box next to
After Update property, select [Event Procedure]. Then click on the box at
far right that has three dots in it. If asked, choose Code Builder from
popup window.

The Visual Basic Editor will open and display (my generic name will be
replaced by real name of combo box):

Private Sub cboBoxName_AfterUpdate()

End Sub


Cursor will be in the blank line between the two lines. Type the following
(using real name of the combo box, not my generic name) on that line (all
one line even if newsreader wraps it):

Me.cboBoxName.DefaultValue = """" & Me.cboBoxName.Value & """"

Go back to the form's design view. Save the form. Close it.

Now, the combo box will use the last entered value while the form is open as
the default value of the next new record.

--

Ken Snell
<MS ACCESS MVP>

Thanks, I am lost enough though, that I don't know how to
apply what you've sent me...if you have time I'd love more
help, but I'm slogging through the dummy book and help
function and surely will find something...thanks, maybe
this will make sense later~
-----Original Message-----
Use the AfterUpdate event of the combo box to set the
default value:

Private Sub cboBoxName_AfterUpdate()
Me.cboBoxName.DefaultValue = """" & _
Me.cboBoxName.Value & """"
End Sub

--

Ken Snell
<MS ACCESS MVP>

Hi, I have a very simple form created that only
captures 9
fields of data, then a control to save the record and
then
start a new record. I'd like to retain the last entered
date (it's a drop down text box I believe)to use with
the
new record. So I would like the date to stay the same
until I change it. Can you set a Default Value for that
somehow? I am so lost...


.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top