Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / July 2007

Tip: Looking for answers? Try searching our database.

Remember last entries in a forms text box or combo box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fletcher - 17 Jul 2007 14:34 GMT
I would like a text box (and a combo box) on a form to remember the
last entry, but still be able to be changed if necessary.  Can someone
point me towards a method of doing this?

I thought I've seen this topic before, but can't seem to find it
anywhere after searching and reading for nearly an hour.

Thanks in advance,

Fletcher
Steve - 17 Jul 2007 14:45 GMT
Put the following code in the AfterUpdate event of your control:
Me!NameOfYourControl.DefaultValue = Me!NameOfYourControl

The control will "remember" the last entry for as long as the form is open
but "memory" will be lost when the form is closed.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
resource@pcdatasheet.com

>I would like a text box (and a combo box) on a form to remember the
> last entry, but still be able to be changed if necessary.  Can someone
[quoted text clipped - 6 lines]
>
> Fletcher
Steve - 17 Jul 2007 15:39 GMT
Sorry, I forgot to add the quotes ---
Me!NameOfYourControl.DefaultValue = "'" & Me!NameOfYourControl & "'"

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
resource@pcdatasheet.com

> Put the following code in the AfterUpdate event of your control:
> Me!NameOfYourControl.DefaultValue = Me!NameOfYourControl
[quoted text clipped - 17 lines]
>>
>> Fletcher
Al Campagna - 17 Jul 2007 14:57 GMT
Fletcher,
  I think what you're referring to is the ability to make a bound control
assume a DefaultValue during an entry/editing "session".
  Let's say you have a field called City, and the next 20 records you want
to add are all "Boston" for the City value.
  Use the AfterUpdate event of City to set a DefaultValue for City.  (Enter
Boston as the City)

       Private Sub City_AfterUpdate()
           Me.City.DefaultValue = "'" & City & "'"
       End If

  Every New record you add during that session will have a City
DefaultValue of "Boston"...
  UNTIL... you change it to something else.
  After 20 Boston records, you enter a "New York" record... now... "New
York" becomes the DefaultValue, and any new records, from then on, will have
a City value of "New York"

  This is only in effect for the current "session" of that form.
Signature

hth
   Al Campagna
   Access MVP 2007
   http://home.comcast.net/~cccsolutions/index.html

   "Find a job that you love, and you'll never work a day in your life."

>I would like a text box (and a combo box) on a form to remember the
> last entry, but still be able to be changed if necessary.  Can someone
[quoted text clipped - 6 lines]
>
> Fletcher
Al Campagna - 17 Jul 2007 15:01 GMT
Fletcher,
  For clarity, I'll expand the quotes in the code I suggested, so you can
it more clearly.
  Do not use the spaces in the real code...
           Me.City.DefaultValue = " ' " & City & " ' "
Signature

hth
   Al Campagna
   Access MVP 2007
   http://home.comcast.net/~cccsolutions/index.html

   "Find a job that you love, and you'll never work a day in your life."

>I would like a text box (and a combo box) on a form to remember the
> last entry, but still be able to be changed if necessary.  Can someone
[quoted text clipped - 6 lines]
>
> Fletcher
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.