Copy From Field To Field

P

Paul

All I want to do is simply, using VB code that can be
operated from a command button do the following:

I already have a form open which is called "Results Form".

I want to open another form called "Club Members Form"
and copy a data from "Results Form" to the "Club Members
Form".

So far I have:

Dim stDocName1 As String
Dim stDocName2 As String

stDocName1 = "Club Members Form"
stDocName2 = "Results Form"

DoCmd.OpenForm stDocName1
DoCmd.OpenForm stDocName2

stDocName1![Value] = stDocName2![Value]

By the way there are fields on each form called "Value"

So all I want to do is copy a value from the "Value"
field on the "Results Form" and paste it into the
field "Value" on the "Club Members Form".

Any help on this would be greatly appreciated
 
D

Dirk Goldgar

Paul said:
All I want to do is simply, using VB code that can be
operated from a command button do the following:

I already have a form open which is called "Results Form".

I want to open another form called "Club Members Form"
and copy a data from "Results Form" to the "Club Members
Form".

So far I have:

Dim stDocName1 As String
Dim stDocName2 As String

stDocName1 = "Club Members Form"
stDocName2 = "Results Form"

DoCmd.OpenForm stDocName1
DoCmd.OpenForm stDocName2

stDocName1![Value] = stDocName2![Value]

By the way there are fields on each form called "Value"

So all I want to do is copy a value from the "Value"
field on the "Results Form" and paste it into the
field "Value" on the "Club Members Form".

Any help on this would be greatly appreciated

"Value" is a very bad name for a field or control, because these objects
also have a Value property, and you don't want Access to get confused,
now do you? However, I expect this will work:

Forms(stDocName1)![Value] = Forms(stDocName2)![Value]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top