473,769 Members | 4,173 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3193
On Mar 21, 10:20 pm, "Jeff" <jeff.pritch... @asken.com.auwr ote:
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.a u
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****@ridesof t.comwrote in message
news:11******** *************@n 76g2000hsh.goog legroups.com...
On Mar 21, 10:20 pm, "Jeff" <jeff.pritch... @asken.com.auwr ote:
>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.a u

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.auwr ote 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****@ridesof t.comwrote in message
news:11******** *************@n 76g2000hsh.goog legroups.com...
>On Mar 21, 10:20 pm, "Jeff" <jeff.pritch... @asken.com.auwr ote:
>>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.a u

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.yabb a.dabba.do.comw rote 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*********@Se eSig.Invalidwro te 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.auwr ote 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****@rideso ft.comwrote in message
news:11******* **************@ n76g2000hsh.goo glegroups.com.. .
>>On Mar 21, 10:20 pm, "Jeff" <jeff.pritch... @asken.com.auwr ote:
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.a u

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.auwr ote 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*********@Se eSig.Invalidwro te 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.auwr ote 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****@rides oft.comwrote in message
news:11****** *************** @n76g2000hsh.go oglegroups.com. ..
On Mar 21, 10:20 pm, "Jeff" <jeff.pritch... @asken.com.auwr ote:
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.a u

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*********@Se eSig.Invalidwro te 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.auwr ote 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
(mlngLastWid th <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*********@Se eSig.Invalidwro te 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.auwr ote 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****@ride soft.comwrote in message
news:11***** *************** *@n76g2000hsh.g ooglegroups.com ...
On Mar 21, 10:20 pm, "Jeff" <jeff.pritch... @asken.com.auwr ote:
>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.a u
>
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
4036
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 which is depended on the other field(TokenID)whether it is blank or not. If the "TokenID" field is blank, the "TokenExpirationDate" field can be blank also. But if the "TokenID" field is not blank or null, the "TokenExpirationDate" field must be...
9
7026
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 it return the associated records to a listbox. Once the listbox has the records, I want to select a record, which will open a form associated with the selected record in the listbox.
19
4108
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 the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
2
2691
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, frmNewMatter, for adding new records to the db. The form is based on tblFile and has a subform based on tblContact,
11
2805
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 (strPubCity) for Publisher City. These two fields have a many-to-one relationship with tables, (tlkpPubName and tlkpPubCity) respectively. The lookup tables only have one field (strPubName and strPubCity), which is their primary key. I also have...
2
4004
by: MLH | last post by:
Fields in MyTable: PostID PostDate RollQtyXfer RollDenomination RollCount37 RollCount23
11
4498
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 AutoNumber* fields in them. Correct me if I'm wrong, but I'm assuming this means that I cannot now alter these existing Access tables and change their primary key to an "AutoNumber" type. If I'm right about this, I need some suggestions as to the...
1
4341
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 logic for a date field. i.e. theValue.defaultvalue = "#" & theValue.value & "#" I can't get this to work for some reason and I can't figure out why. Can anyone out there help? Thanks Repeat value of previous record field into current...
8
1968
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 realtively new at programming.The topic is "Using a database and SQL". The exercise supplies a table called tblStudent in a database called School and requires you to perform certain actions with the table. Here are the requirements that I am having problems...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10222
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10050
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.