By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,059 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

Need Enter key to populate field with value from previous record

P: n/a
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
Share this Question
Share on Google+
8 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.