Picking up values from an earlier record

  • Thread starter NewKidontheBlock
  • Start date
N

NewKidontheBlock

I am building a database that will be used, amongst other things, to record
personal details after a medical review has taken place. One of the forms
involved has about 80 - 100 fields to be completed. Due to the nature of the
illness being monitored many of the answers will be the same as those on the
previous review and it would save an enormous amount of data entry if, when a
new record is started, it could be populated with a selection (most) of the
answers from the previous review.

My VBA skills are developing but still at a very basic level and I have no
idea of how to achieve this.

Would very much appreciate some assistance.

Kind regards

Tony
 
J

jahoobob via AccessMonster.com

See if this thread answers your question.
I am building a database that will be used, amongst other things, to record
personal details after a medical review has taken place. One of the forms
involved has about 80 - 100 fields to be completed. Due to the nature of the
illness being monitored many of the answers will be the same as those on the
previous review and it would save an enormous amount of data entry if, when a
new record is started, it could be populated with a selection (most) of the
answers from the previous review.

My VBA skills are developing but still at a very basic level and I have no
idea of how to achieve this.

Would very much appreciate some assistance.

Kind regards

Tony
 
N

NewKidontheBlock

Sorry to be so thick! I clicked on the link, but where is the answer?

Kind regards

Tony
 
J

jahoobob via AccessMonster.com

Here is an answer that I copied from a thread.:
If you are using a form, you can use the After Update event of the bound
control to set a new default value for the control. For example, if you have
a text box named txtBookTitle that is bound to a text type field named
BookTitle, you can use this code:

Private Sub txtBookTitle_AfterUpdate()
Me.txtBookTitle.DefaultValue = """" & Me.txtBookTitle & """"
End Sub

You can omit the four double-quotes on each side of the control name for
numeric fields.

Hope this helps,
Bob
Sorry to be so thick! I clicked on the link, but where is the answer?

Kind regards

Tony
See if this thread answers your question.
[quoted text clipped - 14 lines]
 
N

NewKidontheBlock

Bob

I'm not sure that it does but, firstly, I'd like to thank you for your time
and willingness to help out 'learners' like me.

My database is to do with the palliative care of people suffering from
multiple sclerosis. The nurse, for whom I'm building this database, reviews
these patients on a fairly regular basis but, as the progression of MS is not
very rapid in many cases, a lot of the answers that applied at the previous
review will still apply and, therefore, it takes a lot of effort to re-enter
all the same data again.

A thought has occurred to me. There is a specific button on the form to add
a new record. Can I add some VBA to its click event to run a query to gather
the data of the last visit before the new record is created and, once it has
been created, update the relevant fields with the gathered values?

For example, after the new record had been created,

Me.booLLWheelchair.Value = qryLastVist.booWheelchair.Value etc?

Is this the sort of syntax I would use?

Nothing to do with the matter in hand, I answered my first post on
AccessMonster today and whilst writing this reply have received some very
positive feedback from the guy that raised the question. It's so good to be
able to 'give' for a change.


Kind regards

Tony


jahoobob via AccessMonster.com said:
Here is an answer that I copied from a thread.:
If you are using a form, you can use the After Update event of the bound
control to set a new default value for the control. For example, if you have
a text box named txtBookTitle that is bound to a text type field named
BookTitle, you can use this code:

Private Sub txtBookTitle_AfterUpdate()
Me.txtBookTitle.DefaultValue = """" & Me.txtBookTitle & """"
End Sub

You can omit the four double-quotes on each side of the control name for
numeric fields.

Hope this helps,
Bob
Sorry to be so thick! I clicked on the link, but where is the answer?

Kind regards

Tony
See if this thread answers your question.
[quoted text clipped - 14 lines]
 
J

jahoobob via AccessMonster.com

Yes, you could add the code before the DoCmd.GoToRecord , , acNewRec. You
can enter the code that I showed you earlier, changing the textbox names
accordinly. You would ned to have a line of code for each textbox you want to
transfer. What that code does is set the Default value for an individual
textbox to what is currently in that textbox. If the form is on the last
record entered then using this code for each textbox you want to transfer
before the add record command should set the value for the new record.

I hope this helps,
Bob
Bob

I'm not sure that it does but, firstly, I'd like to thank you for your time
and willingness to help out 'learners' like me.

My database is to do with the palliative care of people suffering from
multiple sclerosis. The nurse, for whom I'm building this database, reviews
these patients on a fairly regular basis but, as the progression of MS is not
very rapid in many cases, a lot of the answers that applied at the previous
review will still apply and, therefore, it takes a lot of effort to re-enter
all the same data again.

A thought has occurred to me. There is a specific button on the form to add
a new record. Can I add some VBA to its click event to run a query to gather
the data of the last visit before the new record is created and, once it has
been created, update the relevant fields with the gathered values?

For example, after the new record had been created,

Me.booLLWheelchair.Value = qryLastVist.booWheelchair.Value etc?

Is this the sort of syntax I would use?

Nothing to do with the matter in hand, I answered my first post on
AccessMonster today and whilst writing this reply have received some very
positive feedback from the guy that raised the question. It's so good to be
able to 'give' for a change.

Kind regards

Tony
Here is an answer that I copied from a thread.:
If you are using a form, you can use the After Update event of the bound
[quoted text clipped - 23 lines]
 
N

NewKidontheBlock

Thanks Bob. As it's getting on for bed time in the UK I think I'll tackle
that in the morning. You have, however, confirmed my worst fear (a line of
code for each field). Wonderful!!!

Once again thanks for your time and knowledge,

Kind regards

Tony


jahoobob via AccessMonster.com said:
Yes, you could add the code before the DoCmd.GoToRecord , , acNewRec. You
can enter the code that I showed you earlier, changing the textbox names
accordinly. You would ned to have a line of code for each textbox you want to
transfer. What that code does is set the Default value for an individual
textbox to what is currently in that textbox. If the form is on the last
record entered then using this code for each textbox you want to transfer
before the add record command should set the value for the new record.

I hope this helps,
Bob
Bob

I'm not sure that it does but, firstly, I'd like to thank you for your time
and willingness to help out 'learners' like me.

My database is to do with the palliative care of people suffering from
multiple sclerosis. The nurse, for whom I'm building this database, reviews
these patients on a fairly regular basis but, as the progression of MS is not
very rapid in many cases, a lot of the answers that applied at the previous
review will still apply and, therefore, it takes a lot of effort to re-enter
all the same data again.

A thought has occurred to me. There is a specific button on the form to add
a new record. Can I add some VBA to its click event to run a query to gather
the data of the last visit before the new record is created and, once it has
been created, update the relevant fields with the gathered values?

For example, after the new record had been created,

Me.booLLWheelchair.Value = qryLastVist.booWheelchair.Value etc?

Is this the sort of syntax I would use?

Nothing to do with the matter in hand, I answered my first post on
AccessMonster today and whilst writing this reply have received some very
positive feedback from the guy that raised the question. It's so good to be
able to 'give' for a change.

Kind regards

Tony
Here is an answer that I copied from a thread.:
If you are using a form, you can use the After Update event of the bound
[quoted text clipped - 23 lines]
 
J

jahoobob via AccessMonster.com

Just think about how appreciative the nurses will be that you have done this
for them. A reward in itself. Remember that you can copy the first line of
code and just edit the textbox name for each paste.
Thanks Bob. As it's getting on for bed time in the UK I think I'll tackle
that in the morning. You have, however, confirmed my worst fear (a line of
code for each field). Wonderful!!!

Once again thanks for your time and knowledge,

Kind regards

Tony
Yes, you could add the code before the DoCmd.GoToRecord , , acNewRec. You
can enter the code that I showed you earlier, changing the textbox names
[quoted text clipped - 44 lines]
 
Top