473,387 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Need Enter key to populate field with value from previous record

A client wants a press of the Enter key in a field on a continuous form to
grab the value of that field from the previous record.

But if they have typed a value and then hit Enter it shouldn't.

I have tried a few ways but the main problem is that after typing a value
and hitting Enter it still grabs the value from the previous record,
trashing the value they just typed.

Any ideas from you lateral thinkers.

Jeff Pritchard
________________
Asken Research Pty. Ltd.
Access Database Developers
http://www.asken.com.au
Mar 22 '07 #1
8 3130
On Mar 21, 10:20 pm, "Jeff" <jeff.pritch...@asken.com.auwrote:
A client wants a press of the Enter key in a field on a continuous form to
grab the value of that field from the previous record.

But if they have typed a value and then hit Enter it shouldn't.

I have tried a few ways but the main problem is that after typing a value
and hitting Enter it still grabs the value from the previous record,
trashing the value they just typed.

Any ideas from you lateral thinkers.

Jeff Pritchard
________________
Asken Research Pty. Ltd.
Access Database Developershttp://www.asken.com.au
Why don't you try it the other way around? Fill the field when it
gets focus (or maybe enter event) and then when they type, the
previous value will be overwritten. I have not tried that exactly,
but should be doable.

Mar 22 '07 #2
Couple of reasons.

This is to mimic the behaviour of another older system that they use - I kid
you not. Reluctant to change.

Also, if everything is filled in they will have to clear fields that they
don't want to enter, instead of just tabbing through. That's the other bit.
If they don't want to copy the previous value nor enter anything they must
be able to simply tab through.

Is this a worthwhile exercise? Not in my opinion, and I have expressed that.
But the client is trying to get staff to accept the software and thus is
prepared to go to some lengths to do so. Not my preferred approach but not
my call.
<en****@ridesoft.comwrote in message
news:11*********************@n76g2000hsh.googlegro ups.com...
On Mar 21, 10:20 pm, "Jeff" <jeff.pritch...@asken.com.auwrote:
>A client wants a press of the Enter key in a field on a continuous form
to
grab the value of that field from the previous record.

But if they have typed a value and then hit Enter it shouldn't.

I have tried a few ways but the main problem is that after typing a value
and hitting Enter it still grabs the value from the previous record,
trashing the value they just typed.

Any ideas from you lateral thinkers.

Jeff Pritchard
________________
Asken Research Pty. Ltd.
Access Database Developershttp://www.asken.com.au

Why don't you try it the other way around? Fill the field when it
gets focus (or maybe enter event) and then when they type, the
previous value will be overwritten. I have not tried that exactly,
but should be doable.

Mar 22 '07 #3
Jeff, what would they expect if they backspaced the value out, and then
pressed Enter?

If that process should also assign the value from the other record, you
might use the KeyDown event to test if the Text of the control is a
zero-length-string, and if so, assign the value.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jeff" <je************@asken.com.auwrote in message
news:46***********************@per-qv1-newsreader-01.iinet.net.au...
Couple of reasons.

This is to mimic the behaviour of another older system that they use - I
kid you not. Reluctant to change.

Also, if everything is filled in they will have to clear fields that they
don't want to enter, instead of just tabbing through. That's the other
bit. If they don't want to copy the previous value nor enter anything they
must be able to simply tab through.

Is this a worthwhile exercise? Not in my opinion, and I have expressed
that. But the client is trying to get staff to accept the software and
thus is prepared to go to some lengths to do so. Not my preferred approach
but not my call.
<en****@ridesoft.comwrote in message
news:11*********************@n76g2000hsh.googlegro ups.com...
>On Mar 21, 10:20 pm, "Jeff" <jeff.pritch...@asken.com.auwrote:
>>A client wants a press of the Enter key in a field on a continuous form
to
grab the value of that field from the previous record.

But if they have typed a value and then hit Enter it shouldn't.

I have tried a few ways but the main problem is that after typing a
value
and hitting Enter it still grabs the value from the previous record,
trashing the value they just typed.

Any ideas from you lateral thinkers.

Jeff Pritchard
________________
Asken Research Pty. Ltd.
Access Database Developershttp://www.asken.com.au

Why don't you try it the other way around? Fill the field when it
gets focus (or maybe enter event) and then when they type, the
previous value will be overwritten. I have not tried that exactly,
but should be doable.
Mar 22 '07 #4
rkc
Jeff wrote:
Couple of reasons.

This is to mimic the behaviour of another older system that they use - I kid
you not. Reluctant to change.
They really can't adapt to the already available ctrl+' ?
Mar 22 '07 #5
That doesn't work on a continuous form used in a subform. At least not for
me.

Even if it did, I doubt that that would be good enough.

A couple of staff have trouble adapting to a database generally. Their
previous system was basically paper based. One guy actually resigned because
he didn't want to deal with it. Mind you, he was getting ready to retire and
I think this just made his mind up.

"rkc" <rk*@rkcny.yabba.dabba.do.comwrote in message
news:46**********************@roadrunner.com...
Jeff wrote:
>Couple of reasons.

This is to mimic the behaviour of another older system that they use - I
kid you not. Reluctant to change.

They really can't adapt to the already available ctrl+' ?

Mar 26 '07 #6
Good question. I expect that they would want it to copy the previous value.
I will ask and check what happens in the other software.

At the moment I am using the KeyDown event to handle things but have a
little problem when you enter a value but still hit Enter. It still copies
the value trashing the one entered. I have to stop copying if something is
entered, but any test for something entered, such as a test for not null,
fails as the record has not been saved, I think.

If (KeyCode = vbKeyReturn) And (Nz([txtPartWidth], 0) = 0) And
(mlngLastWidth <0) Then
[txtPartWidth] = mlngLastWidth
End If

txtPartWidth adopts the default value and there doesn't seem to be any way
to determine what has been typed in.

Am I missing something obvious here?

"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:46***********************@per-qv1-newsreader-01.iinet.net.au...
Jeff, what would they expect if they backspaced the value out, and then
pressed Enter?

If that process should also assign the value from the other record, you
might use the KeyDown event to test if the Text of the control is a
zero-length-string, and if so, assign the value.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jeff" <je************@asken.com.auwrote in message
news:46***********************@per-qv1-newsreader-01.iinet.net.au...
>Couple of reasons.

This is to mimic the behaviour of another older system that they use - I
kid you not. Reluctant to change.

Also, if everything is filled in they will have to clear fields that they
don't want to enter, instead of just tabbing through. That's the other
bit. If they don't want to copy the previous value nor enter anything
they must be able to simply tab through.

Is this a worthwhile exercise? Not in my opinion, and I have expressed
that. But the client is trying to get staff to accept the software and
thus is prepared to go to some lengths to do so. Not my preferred
approach but not my call.
<en****@ridesoft.comwrote in message
news:11*********************@n76g2000hsh.googlegr oups.com...
>>On Mar 21, 10:20 pm, "Jeff" <jeff.pritch...@asken.com.auwrote:
A client wants a press of the Enter key in a field on a continuous form
to
grab the value of that field from the previous record.

But if they have typed a value and then hit Enter it shouldn't.

I have tried a few ways but the main problem is that after typing a
value
and hitting Enter it still grabs the value from the previous record,
trashing the value they just typed.

Any ideas from you lateral thinkers.

Jeff Pritchard
________________
Asken Research Pty. Ltd.
Access Database Developershttp://www.asken.com.au

Why don't you try it the other way around? Fill the field when it
gets focus (or maybe enter event) and then when they type, the
previous value will be overwritten. I have not tried that exactly,
but should be doable.

Mar 26 '07 #7
Test the Text property of the control, e.g.:
If Me.txtPartWidth.Text <vbNullString Then

Its Value has not been updated at the time the Change or Keyxxx events fire.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jeff" <je************@asken.com.auwrote in message
news:46**********************@per-qv1-newsreader-01.iinet.net.au...
Good question. I expect that they would want it to copy the previous
value. I will ask and check what happens in the other software.

At the moment I am using the KeyDown event to handle things but have a
little problem when you enter a value but still hit Enter. It still copies
the value trashing the one entered. I have to stop copying if something is
entered, but any test for something entered, such as a test for not null,
fails as the record has not been saved, I think.

If (KeyCode = vbKeyReturn) And (Nz([txtPartWidth], 0) = 0) And
(mlngLastWidth <0) Then
[txtPartWidth] = mlngLastWidth
End If

txtPartWidth adopts the default value and there doesn't seem to be any way
to determine what has been typed in.

Am I missing something obvious here?

"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:46***********************@per-qv1-newsreader-01.iinet.net.au...
>Jeff, what would they expect if they backspaced the value out, and then
pressed Enter?

If that process should also assign the value from the other record, you
might use the KeyDown event to test if the Text of the control is a
zero-length-string, and if so, assign the value.

"Jeff" <je************@asken.com.auwrote in message
news:46***********************@per-qv1-newsreader-01.iinet.net.au...
>>Couple of reasons.

This is to mimic the behaviour of another older system that they use - I
kid you not. Reluctant to change.

Also, if everything is filled in they will have to clear fields that
they don't want to enter, instead of just tabbing through. That's the
other bit. If they don't want to copy the previous value nor enter
anything they must be able to simply tab through.

Is this a worthwhile exercise? Not in my opinion, and I have expressed
that. But the client is trying to get staff to accept the software and
thus is prepared to go to some lengths to do so. Not my preferred
approach but not my call.
<en****@ridesoft.comwrote in message
news:11*********************@n76g2000hsh.googleg roups.com...
On Mar 21, 10:20 pm, "Jeff" <jeff.pritch...@asken.com.auwrote:
A client wants a press of the Enter key in a field on a continuous
form to
grab the value of that field from the previous record.
>
But if they have typed a value and then hit Enter it shouldn't.
>
I have tried a few ways but the main problem is that after typing a
value
and hitting Enter it still grabs the value from the previous record,
trashing the value they just typed.
>
Any ideas from you lateral thinkers.
>
Jeff Pritchard
________________
Asken Research Pty. Ltd.
Access Database Developershttp://www.asken.com.au

Why don't you try it the other way around? Fill the field when it
gets focus (or maybe enter event) and then when they type, the
previous value will be overwritten. I have not tried that exactly,
but should be doable
Mar 26 '07 #8
Thanks Allen. That and a couple of tweaks and problem solved.

"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:46**********************@per-qv1-newsreader-01.iinet.net.au...
Test the Text property of the control, e.g.:
If Me.txtPartWidth.Text <vbNullString Then

Its Value has not been updated at the time the Change or Keyxxx events
fire.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Jeff" <je************@asken.com.auwrote in message
news:46**********************@per-qv1-newsreader-01.iinet.net.au...
>Good question. I expect that they would want it to copy the previous
value. I will ask and check what happens in the other software.

At the moment I am using the KeyDown event to handle things but have a
little problem when you enter a value but still hit Enter. It still
copies the value trashing the one entered. I have to stop copying if
something is entered, but any test for something entered, such as a test
for not null, fails as the record has not been saved, I think.

If (KeyCode = vbKeyReturn) And (Nz([txtPartWidth], 0) = 0) And
(mlngLastWidth <0) Then
[txtPartWidth] = mlngLastWidth
End If

txtPartWidth adopts the default value and there doesn't seem to be any
way to determine what has been typed in.

Am I missing something obvious here?

"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:46***********************@per-qv1-newsreader-01.iinet.net.au...
>>Jeff, what would they expect if they backspaced the value out, and then
pressed Enter?

If that process should also assign the value from the other record, you
might use the KeyDown event to test if the Text of the control is a
zero-length-string, and if so, assign the value.

"Jeff" <je************@asken.com.auwrote in message
news:46***********************@per-qv1-newsreader-01.iinet.net.au...
Couple of reasons.

This is to mimic the behaviour of another older system that they use -
I kid you not. Reluctant to change.

Also, if everything is filled in they will have to clear fields that
they don't want to enter, instead of just tabbing through. That's the
other bit. If they don't want to copy the previous value nor enter
anything they must be able to simply tab through.

Is this a worthwhile exercise? Not in my opinion, and I have expressed
that. But the client is trying to get staff to accept the software and
thus is prepared to go to some lengths to do so. Not my preferred
approach but not my call.
<en****@ridesoft.comwrote in message
news:11*********************@n76g2000hsh.google groups.com...
On Mar 21, 10:20 pm, "Jeff" <jeff.pritch...@asken.com.auwrote:
>A client wants a press of the Enter key in a field on a continuous
>form to
>grab the value of that field from the previous record.
>>
>But if they have typed a value and then hit Enter it shouldn't.
>>
>I have tried a few ways but the main problem is that after typing a
>value
>and hitting Enter it still grabs the value from the previous record,
>trashing the value they just typed.
>>
>Any ideas from you lateral thinkers.
>>
>Jeff Pritchard
>________________
>Asken Research Pty. Ltd.
>Access Database Developershttp://www.asken.com.au
>
Why don't you try it the other way around? Fill the field when it
gets focus (or maybe enter event) and then when they type, the
previous value will be overwritten. I have not tried that exactly,
but should be doable

Mar 27 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: qsweetbee | last post by:
I have a form(fAddUsers) in my database. It is continue form for data entry. Some fields are required fields. Some are optional fields. There is 1 particular filed(TokenExpirationDate)on the form...
9
by: Megan | last post by:
Hi- I'm creating a database of music bands with their cds and songs. I'm trying to program an SQL statement so that I can enter a string of text in a textbox, press the 'Enter' key, and have...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
2
by: Uninvisible | last post by:
I have put together a db for a law firm to keep track of counterfeit activities. There are four parent tables: tblContact tblTransaction tblAction tblFile I have created a form,...
11
by: my-wings | last post by:
I think I've painted myself into a corner, and I'm hoping someone can help me out. I have a table of books (tblBooks), which includes a field (strPubName) for Publisher Name and another field...
2
by: MLH | last post by:
Fields in MyTable: PostID PostDate RollQtyXfer RollDenomination RollCount37 RollCount23
11
by: Alan Mailer | last post by:
A project I'm working on is going to use VB6 as a front end. The back end is going to be pre-existing MS Access 2002 database tables which already have records in them *but do not have any...
1
by: roveagh1 | last post by:
Hi I've been using the 2 year old link below to repeat values from previous record field into current corresponding field. It's worked fine for text but the last piece of advice was to use the same...
8
by: 08butoryr | last post by:
Hey guys I could really use your help with some very basic java programming. I know you programming fundis out there will find this child's play but I'm struggling with it a bit because I'm...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.