Autopopulating a field on a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form which has a student's details, together with the Caregiver One
and Caregiver Two details. I want the Last Names and Addresses of the
Caregivers to DEFAULT to that of the student's details [to stop the user
having to double enter everything]

I don't think the default properties is the place to do it, and I've tried a
DLOOKUP, which doesn't work. What is the best way to get this to work?

TIA --
Sue Compelling
 
In the after update event of each of the student details fields put something
like this
caregiver1.sametypeoffield = thisstudentdetailsfield
caregiver2.sametypeoffield = thisstudentdetailsfield
 
Hi Dennis - thanks for being so prompt. I'm afraid I'm a newbie at this and
need a little more assistance. If I give you the specifics are you able to
help me construct the command?

The Student's last name field is called 'SLastName'
The Caregiver1 last name field is called 'CG1LastName'
The Caregiver2 last name field is called 'CG2LastName'

I tried to do it but after entering this statement 'CG1LastName = SLastName;
CG2LastName = SLastName' in the After Update field it came back with an error
message ... 'Microsoft Access can't find the macro 'CG1LastName = SLastName;
CG2LastName = SLastName.' - what do I do? Do I need to create a macro? and
if so - what type

TIA
--
Sue Compelling


Dennis said:
In the after update event of each of the student details fields put something
like this
caregiver1.sametypeoffield = thisstudentdetailsfield
caregiver2.sametypeoffield = thisstudentdetailsfield



Sue Compelling said:
I have a form which has a student's details, together with the Caregiver One
and Caregiver Two details. I want the Last Names and Addresses of the
Caregivers to DEFAULT to that of the student's details [to stop the user
having to double enter everything]

I don't think the default properties is the place to do it, and I've tried a
DLOOKUP, which doesn't work. What is the best way to get this to work?

TIA --
Sue Compelling
 
In the after update event property of the SLastName field, change it to
[Event Procedure] from the drop down list and then click on the ... button at
the side.
You are then in the VBA code for the form or in this case the after update
event of that field. You then enter
CG1LastName = SLastName
CG2LastName = SLastName

Sue Compelling said:
Hi Dennis - thanks for being so prompt. I'm afraid I'm a newbie at this and
need a little more assistance. If I give you the specifics are you able to
help me construct the command?

The Student's last name field is called 'SLastName'
The Caregiver1 last name field is called 'CG1LastName'
The Caregiver2 last name field is called 'CG2LastName'

I tried to do it but after entering this statement 'CG1LastName = SLastName;
CG2LastName = SLastName' in the After Update field it came back with an error
message ... 'Microsoft Access can't find the macro 'CG1LastName = SLastName;
CG2LastName = SLastName.' - what do I do? Do I need to create a macro? and
if so - what type

TIA
--
Sue Compelling


Dennis said:
In the after update event of each of the student details fields put something
like this
caregiver1.sametypeoffield = thisstudentdetailsfield
caregiver2.sametypeoffield = thisstudentdetailsfield



Sue Compelling said:
I have a form which has a student's details, together with the Caregiver One
and Caregiver Two details. I want the Last Names and Addresses of the
Caregivers to DEFAULT to that of the student's details [to stop the user
having to double enter everything]

I don't think the default properties is the place to do it, and I've tried a
DLOOKUP, which doesn't work. What is the best way to get this to work?

TIA --
Sue Compelling
 
Dennis - brilliant. I'm now the proud owner of my first bit of code [apart
from a DoCmd.Maximise]. Is there a way I can get this to populate the fields
WITHOUT having to go to the next record and back again? I tried a DoCmd.Save
but that didn't work.
--
Sue Compelling


Dennis said:
In the after update event property of the SLastName field, change it to
[Event Procedure] from the drop down list and then click on the ... button at
the side.
You are then in the VBA code for the form or in this case the after update
event of that field. You then enter
CG1LastName = SLastName
CG2LastName = SLastName

Sue Compelling said:
Hi Dennis - thanks for being so prompt. I'm afraid I'm a newbie at this and
need a little more assistance. If I give you the specifics are you able to
help me construct the command?

The Student's last name field is called 'SLastName'
The Caregiver1 last name field is called 'CG1LastName'
The Caregiver2 last name field is called 'CG2LastName'

I tried to do it but after entering this statement 'CG1LastName = SLastName;
CG2LastName = SLastName' in the After Update field it came back with an error
message ... 'Microsoft Access can't find the macro 'CG1LastName = SLastName;
CG2LastName = SLastName.' - what do I do? Do I need to create a macro? and
if so - what type

TIA
--
Sue Compelling


Dennis said:
In the after update event of each of the student details fields put something
like this
caregiver1.sametypeoffield = thisstudentdetailsfield
caregiver2.sametypeoffield = thisstudentdetailsfield



:

I have a form which has a student's details, together with the Caregiver One
and Caregiver Two details. I want the Last Names and Addresses of the
Caregivers to DEFAULT to that of the student's details [to stop the user
having to double enter everything]

I don't think the default properties is the place to do it, and I've tried a
DLOOKUP, which doesn't work. What is the best way to get this to work?

TIA --
Sue Compelling
 
This code works when you move focus away from the SLastName field, so press
return or tab to the next field on your form.

Sue Compelling said:
Dennis - brilliant. I'm now the proud owner of my first bit of code [apart
from a DoCmd.Maximise]. Is there a way I can get this to populate the fields
WITHOUT having to go to the next record and back again? I tried a DoCmd.Save
but that didn't work.
--
Sue Compelling


Dennis said:
In the after update event property of the SLastName field, change it to
[Event Procedure] from the drop down list and then click on the ... button at
the side.
You are then in the VBA code for the form or in this case the after update
event of that field. You then enter
CG1LastName = SLastName
CG2LastName = SLastName

Sue Compelling said:
Hi Dennis - thanks for being so prompt. I'm afraid I'm a newbie at this and
need a little more assistance. If I give you the specifics are you able to
help me construct the command?

The Student's last name field is called 'SLastName'
The Caregiver1 last name field is called 'CG1LastName'
The Caregiver2 last name field is called 'CG2LastName'

I tried to do it but after entering this statement 'CG1LastName = SLastName;
CG2LastName = SLastName' in the After Update field it came back with an error
message ... 'Microsoft Access can't find the macro 'CG1LastName = SLastName;
CG2LastName = SLastName.' - what do I do? Do I need to create a macro? and
if so - what type

TIA
--
Sue Compelling


:

In the after update event of each of the student details fields put something
like this
caregiver1.sametypeoffield = thisstudentdetailsfield
caregiver2.sametypeoffield = thisstudentdetailsfield



:

I have a form which has a student's details, together with the Caregiver One
and Caregiver Two details. I want the Last Names and Addresses of the
Caregivers to DEFAULT to that of the student's details [to stop the user
having to double enter everything]

I don't think the default properties is the place to do it, and I've tried a
DLOOKUP, which doesn't work. What is the best way to get this to work?

TIA --
Sue Compelling
 
--
Sue Compelling


Dennis said:
This code works when you move focus away from the SLastName field, so press
return or tab to the next field on your form.

Sue Compelling said:
Dennis - brilliant. I'm now the proud owner of my first bit of code [apart
from a DoCmd.Maximise]. Is there a way I can get this to populate the fields
WITHOUT having to go to the next record and back again? I tried a DoCmd.Save
but that didn't work.
--
Sue Compelling


Dennis said:
In the after update event property of the SLastName field, change it to
[Event Procedure] from the drop down list and then click on the ... button at
the side.
You are then in the VBA code for the form or in this case the after update
event of that field. You then enter
CG1LastName = SLastName
CG2LastName = SLastName

:

Hi Dennis - thanks for being so prompt. I'm afraid I'm a newbie at this and
need a little more assistance. If I give you the specifics are you able to
help me construct the command?

The Student's last name field is called 'SLastName'
The Caregiver1 last name field is called 'CG1LastName'
The Caregiver2 last name field is called 'CG2LastName'

I tried to do it but after entering this statement 'CG1LastName = SLastName;
CG2LastName = SLastName' in the After Update field it came back with an error
message ... 'Microsoft Access can't find the macro 'CG1LastName = SLastName;
CG2LastName = SLastName.' - what do I do? Do I need to create a macro? and
if so - what type

TIA
--
Sue Compelling


:

In the after update event of each of the student details fields put something
like this
caregiver1.sametypeoffield = thisstudentdetailsfield
caregiver2.sametypeoffield = thisstudentdetailsfield



:

I have a form which has a student's details, together with the Caregiver One
and Caregiver Two details. I want the Last Names and Addresses of the
Caregivers to DEFAULT to that of the student's details [to stop the user
having to double enter everything]

I don't think the default properties is the place to do it, and I've tried a
DLOOKUP, which doesn't work. What is the best way to get this to work?

TIA --
Sue Compelling
 
This is just what I have been trying to do myself. I followed these
instructions and nothing happens at all. The only difference I can see is
that I am using Access 2003. What else can I try? If I put the code in the
Control source it works great, but of course, it does not update the table.
Any suggestions?

Jack Paden


Dennis said:
This code works when you move focus away from the SLastName field, so press
return or tab to the next field on your form.

Sue Compelling said:
Dennis - brilliant. I'm now the proud owner of my first bit of code [apart
from a DoCmd.Maximise]. Is there a way I can get this to populate the fields
WITHOUT having to go to the next record and back again? I tried a DoCmd.Save
but that didn't work.
--
Sue Compelling


Dennis said:
In the after update event property of the SLastName field, change it to
[Event Procedure] from the drop down list and then click on the ... button at
the side.
You are then in the VBA code for the form or in this case the after update
event of that field. You then enter
CG1LastName = SLastName
CG2LastName = SLastName

:

Hi Dennis - thanks for being so prompt. I'm afraid I'm a newbie at this and
need a little more assistance. If I give you the specifics are you able to
help me construct the command?

The Student's last name field is called 'SLastName'
The Caregiver1 last name field is called 'CG1LastName'
The Caregiver2 last name field is called 'CG2LastName'

I tried to do it but after entering this statement 'CG1LastName = SLastName;
CG2LastName = SLastName' in the After Update field it came back with an error
message ... 'Microsoft Access can't find the macro 'CG1LastName = SLastName;
CG2LastName = SLastName.' - what do I do? Do I need to create a macro? and
if so - what type

TIA
--
Sue Compelling


:

In the after update event of each of the student details fields put something
like this
caregiver1.sametypeoffield = thisstudentdetailsfield
caregiver2.sametypeoffield = thisstudentdetailsfield



:

I have a form which has a student's details, together with the Caregiver One
and Caregiver Two details. I want the Last Names and Addresses of the
Caregivers to DEFAULT to that of the student's details [to stop the user
having to double enter everything]

I don't think the default properties is the place to do it, and I've tried a
DLOOKUP, which doesn't work. What is the best way to get this to work?

TIA --
Sue Compelling
 
Back
Top