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

Copying data from field to field in form automatically ?

P: n/a
Hi everybody - hope you can help out here.

I have a form in a database, which is a columnar form from one of the tables
in the db - there is a sub-form to the form which is a datasheet view of
another table in the db. The LinkChilds property is set to show connected
records from both tables.

What I'd like to do is copy and paste, or use some other method of writing,
the contents of one field in one table in the form, to a field in the table
in the sub-form, preferably with a button on the form which will copy the
data without having to manually copy and paste from field to field.

Is this sort of thing possible ?, and could anybody maybe point me in the
right direction as to how it might be done.

Cheers, and thanks in advance.

Andy

A N D R E W H U T C H I N G S , N E W C A S T L E UK
e-mail: an**@airnorth.demon.co.uk

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003
Nov 12 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
DFS
Andy,

Put the main form in design mode, drop a command button on it, and add some
code like this to the button's OnClick property (it will copy from the main
form to the subform):

me.subFormName.Form.Field1Name = me.Field1Name
me.subFormName.Form.Field2Name = me.Field2Name
....

"Andy Hutchings" <an**@airnorth.demon.co.uk> wrote in message
news:bq*******************@news.demon.co.uk...
Hi everybody - hope you can help out here.

I have a form in a database, which is a columnar form from one of the tables in the db - there is a sub-form to the form which is a datasheet view of
another table in the db. The LinkChilds property is set to show connected
records from both tables.

What I'd like to do is copy and paste, or use some other method of writing, the contents of one field in one table in the form, to a field in the table in the sub-form, preferably with a button on the form which will copy the
data without having to manually copy and paste from field to field.

Is this sort of thing possible ?, and could anybody maybe point me in the
right direction as to how it might be done.

Cheers, and thanks in advance.

Andy

A N D R E W H U T C H I N G S , N E W C A S T L E UK
e-mail: an**@airnorth.demon.co.uk

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003

Nov 12 '05 #2

P: n/a
Thanks very much for the prompt reply - I have tried it, but I don't think
I'm writing the code correctly.

I'm not sure what 'me' is ..... could you re-write the code with my db names
etc. in their correct place, as per the following names please.

Database name = Civil
Form name = Changes (same name as underlying table)
sub-form name = bbH (same name as underlying table)
Field name in Changes = NAME
Field name in bbH = OWNER

I want the field NAME in Changes to be written to the field OWNER in bbH

Sorry if I'm totally thick, and thanks again

Andy

"DFS" <no******@nospam.com> wrote in message
news:vs************@corp.supernews.com...
Andy,

Put the main form in design mode, drop a command button on it, and add some code like this to the button's OnClick property (it will copy from the main form to the subform):

me.subFormName.Form.Field1Name = me.Field1Name
me.subFormName.Form.Field2Name = me.Field2Name
...

"Andy Hutchings" <an**@airnorth.demon.co.uk> wrote in message
news:bq*******************@news.demon.co.uk...
Hi everybody - hope you can help out here.

I have a form in a database, which is a columnar form from one of the

tables
in the db - there is a sub-form to the form which is a datasheet view of
another table in the db. The LinkChilds property is set to show connected records from both tables.

What I'd like to do is copy and paste, or use some other method of

writing,
the contents of one field in one table in the form, to a field in the

table
in the sub-form, preferably with a button on the form which will copy the data without having to manually copy and paste from field to field.

Is this sort of thing possible ?, and could anybody maybe point me in the right direction as to how it might be done.

Cheers, and thanks in advance.

Andy

A N D R E W H U T C H I N G S , N E W C A S T L E UK
e-mail: an**@airnorth.demon.co.uk

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003
Nov 12 '05 #3

P: n/a
DFS
"Andy Hutchings" <an**@airnorth.demon.co.uk> wrote in message
news:bq*******************@news.demon.co.uk...
Thanks very much for the prompt reply - I have tried it, but I don't think
I'm writing the code correctly.

I'm not sure what 'me' is ..... could you re-write the code with my db names etc. in their correct place, as per the following names please.

Database name = Civil
Form name = Changes (same name as underlying table)
sub-form name = bbH (same name as underlying table)
Field name in Changes = NAME
Field name in bbH = OWNER

I want the field NAME in Changes to be written to the field OWNER in bbH
Andy, for purposes of this particular line of code:

database name = Civil = not important
Form name = Changes = not important
sub-form name = bbH = important
Me = reference to form executing the code = imporant
Field name in Changes = NAME = important
Field name in bbH = OWNER = important
On form "Changes", add a click button and this code to it:

me.bbH.Form.OWNER = me.[NAME]

(note: I put Name in brackets because it's a common property of Access
objects. In general you shouldn't use NAME as a field name).

Sorry if I'm totally thick, and thanks again

Andy

"DFS" <no******@nospam.com> wrote in message
news:vs************@corp.supernews.com...
Andy,

Put the main form in design mode, drop a command button on it, and add

some
code like this to the button's OnClick property (it will copy from the

main
form to the subform):

me.subFormName.Form.Field1Name = me.Field1Name
me.subFormName.Form.Field2Name = me.Field2Name
...

"Andy Hutchings" <an**@airnorth.demon.co.uk> wrote in message
news:bq*******************@news.demon.co.uk...
Hi everybody - hope you can help out here.

I have a form in a database, which is a columnar form from one of the

tables
in the db - there is a sub-form to the form which is a datasheet view of another table in the db. The LinkChilds property is set to show connected records from both tables.

What I'd like to do is copy and paste, or use some other method of

writing,
the contents of one field in one table in the form, to a field in the

table
in the sub-form, preferably with a button on the form which will copy the data without having to manually copy and paste from field to field.

Is this sort of thing possible ?, and could anybody maybe point me in the right direction as to how it might be done.

Cheers, and thanks in advance.

Andy

A N D R E W H U T C H I N G S , N E W C A S T L E UK
e-mail: an**@airnorth.demon.co.uk

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003

Nov 12 '05 #4

P: n/a
Thank you again very much for confirming that code.

I have done as you said, but am now getting an error message "Microsoft
Access can't find the macro 'me'." when I click the button to try to execute
the operation. I'm using Access97 btw ...

Thank you very much

Andy
e-mail: an**@airnorth.demon.co.uk
"DFS" <no******@nospam.com> wrote in message
news:vs************@corp.supernews.com...
"Andy Hutchings" <an**@airnorth.demon.co.uk> wrote in message
news:bq*******************@news.demon.co.uk...
Thanks very much for the prompt reply - I have tried it, but I don't think
I'm writing the code correctly.

I'm not sure what 'me' is ..... could you re-write the code with my db names
etc. in their correct place, as per the following names please.

Database name = Civil
Form name = Changes (same name as underlying table)
sub-form name = bbH (same name as underlying table)
Field name in Changes = NAME
Field name in bbH = OWNER

I want the field NAME in Changes to be written to the field OWNER in bbH


Andy, for purposes of this particular line of code:

database name = Civil = not important
Form name = Changes = not important
sub-form name = bbH = important
Me = reference to form executing the code = imporant
Field name in Changes = NAME = important
Field name in bbH = OWNER = important
On form "Changes", add a click button and this code to it:

me.bbH.Form.OWNER = me.[NAME]

(note: I put Name in brackets because it's a common property of Access
objects. In general you shouldn't use NAME as a field name).

Sorry if I'm totally thick, and thanks again

Andy

"DFS" <no******@nospam.com> wrote in message
news:vs************@corp.supernews.com...
Andy,

Put the main form in design mode, drop a command button on it, and add

some
code like this to the button's OnClick property (it will copy from the

main
form to the subform):

me.subFormName.Form.Field1Name = me.Field1Name
me.subFormName.Form.Field2Name = me.Field2Name
...

"Andy Hutchings" <an**@airnorth.demon.co.uk> wrote in message
news:bq*******************@news.demon.co.uk...
> Hi everybody - hope you can help out here.
>
> I have a form in a database, which is a columnar form from one of the tables
> in the db - there is a sub-form to the form which is a datasheet view of > another table in the db. The LinkChilds property is set to show

connected
> records from both tables.
>
> What I'd like to do is copy and paste, or use some other method of
writing,
> the contents of one field in one table in the form, to a field in
the table
> in the sub-form, preferably with a button on the form which will

copy the
> data without having to manually copy and paste from field to field.
>
> Is this sort of thing possible ?, and could anybody maybe point me
in the
> right direction as to how it might be done.
>
> Cheers, and thanks in advance.
>
> Andy
>
> A N D R E W H U T C H I N G S , N E W C A S T L E UK
> e-mail: an**@airnorth.demon.co.uk
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003
>
>

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.545 / Virus Database: 339 - Release Date: 27/11/2003
Nov 12 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.