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 / May 2007

Tip: Looking for answers? Try searching our database.

remember the last entry in a text box on a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
asc4john - 29 May 2007 20:00 GMT
I am currently trying to get a form entry text box to remember the
last entry so as not to have to retype it each time.
I am using this code:

Private Sub tbxPartNumber_AfterUpdate()
   tbxPartNumber.DefaultValue = tbxPartNumber
End Sub

The data entered is like 20-40-2345 as a string, but the default value
entered into the text box for the next record is -2365.
Is there a better way to do this?  or How do I stop Access from doing
the calculation?

Thanks
Jeff Boyce - 29 May 2007 20:26 GMT
What is the data type of the underlying field?

You could consider using the CStr() function to coerce the value of
txtPartNumber into a text/string format.

Regards

Jeff Boyce
Microsoft Office/Access MVP

>I am currently trying to get a form entry text box to remember the
> last entry so as not to have to retype it each time.
[quoted text clipped - 10 lines]
>
> Thanks
asc4john - 29 May 2007 20:36 GMT
> What is the data type of the underlying field?
>
[quoted text clipped - 22 lines]
>
> - Show quoted text -

The field is text 50 characters and I tried Cstr but that did not
work.
Jeff Boyce - 29 May 2007 21:16 GMT
Where did you try CStr()?

Regards

Jeff Boyce
Microsoft Office/Access MVP

>> What is the data type of the underlying field?
>>
[quoted text clipped - 25 lines]
> The field is text 50 characters and I tried Cstr but that did not
> work.
asc4john - 29 May 2007 21:49 GMT
> Where did you try CStr()?
>
[quoted text clipped - 38 lines]
>
> - Show quoted text -

The only place I could think of   tbxPartNumber.DefaultValue =
Cstr(tbxPartNumber).  I also tried some MsgBoxes  in the BeforeUpdate
and AfterUpdate and they showed 20-40-2345 but in the form and in the
table I have the difference. Different part number values produce the
same result (except the difference).  MsgBoxes show the part number
but the form and table show/store the difference.
Jeff Boyce - 29 May 2007 22:39 GMT
The fact that Access is calculating a difference rather than treating the
string as a string suggests that Access believes it is numeric, not text.
Try taking another look at all the places you may have defined or formatted
that information...

The table, naturally, but also in any forms, queries, ...

Regards

Jeff Boyce
Microsoft Office/Access MVP

>> Where did you try CStr()?
>>
[quoted text clipped - 47 lines]
> same result (except the difference).  MsgBoxes show the part number
> but the form and table show/store the difference.
asc4john - 29 May 2007 22:52 GMT
> The fact that Access is calculating a difference rather than treating the
> string as a string suggests that Access believes it is numeric, not text.
[quoted text clipped - 65 lines]
>
> - Show quoted text -

The only add thing I can find is that text boxes placed in the form
header give format options, while text boxes in the detail section do
not give formatting options the drop-down is blank.  Combo boxes in
the detail section do give formatting options.
There is no numeric use made of the part number field in the table,
forms or queries. I am using the above method on several combo boxes
and they work fine.
Jeff Boyce - 30 May 2007 00:01 GMT
Sorry, I'm fresh out of ideas.

On occasion, when a control or a form just doesn't "behave", I've been known
to delete it and start over.  If none of your objects calls for a numeric
formatting/data type, then maybe Access is confused and you just need to
rebuild that portion...?

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP

>> The fact that Access is calculating a difference rather than treating the
>> string as a string suggests that Access believes it is numeric, not text.
[quoted text clipped - 74 lines]
> forms or queries. I am using the above method on several combo boxes
> and they work fine.
Fletcher - 30 May 2007 13:35 GMT
> Sorry, I'm fresh out of ideas.
>
[quoted text clipped - 94 lines]
>
> - Show quoted text -

I usually put quotation marks around numbers with hyphens.  It works
for me.
Just a thought.
asc4john - 30 May 2007 14:00 GMT
> > Sorry, I'm fresh out of ideas.
>
[quoted text clipped - 104 lines]
>
> - Show quoted text -

Tried that but it adds quotation marke into the table and I can not
have that, as it causes problems elsewhere.
The whole thing is just odd.
 
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.