PC Review


Reply
Thread Tools Rate Thread

Copy data from one SubForm to another

 
 
ryguy7272
Guest
Posts: n/a
 
      25th Jan 2010
I’m working on a certain task, to copy data from one SubForm to another
SubForm. I know Access is not really designed for these kinds of things, but
there is a legitimate reason for doing this; an offsetting position on
options trades where all elements of data are almost exactly the same except
for the put/call position.

Anyway, below is the code:
Option Compare Database

Private Sub btnAddCross_Click()

Dim strCross As String
Dim ctl As Control

strCross = "TradesCrossed"
DoCmd.OpenForm strCross, acNormal, , , acFormAdd

For Each ctl In Me.Opt.Form.Controls
If ctl.Tag = "CrossData" Then
Forms(strCross).Opt.Form.Controls(ctl.Name) = ctl.Value
End If
Next ctl

End Sub

This line causes the error:
For Each ctl In Me.Opt.Form.Controls

Specifically, this part seems to be causing the problem:
..Opt

Someone pointed out that the Form, which works as a SubForm within a Form,
may be named something other than ‘Opt’ but I don’t know how that can be
possible. If I go into Design View in the Form named ‘Trades’ and click on
the SubForm named ‘Opt’, in the Properties, the name really is ‘Opt’.

This is sitting behind a Form named ‘Opt’, and this is embedded as a SubForm
in a Form named ‘Trades’. I have another Form, named ‘OptCrossed’, and this
is embedded as a SubForm in a Form named ‘TradesCrossed’.

I want to click a Button named ‘btnAddCross’ and copy the data from ‘Opt’ to
‘OptCrossed’. The data that feeds ‘Opt’, i.e., the Record Source, is called
‘QueryWorking’ (just a silly name I came up with to test this). I don’t
think the name of the Record Source is relevant, but I just wanted to throw
it out there.

Some of you reading this may recognize this post from about 1 months ago. I
thought this was kind of working, but actually, this never really worked
right.

Any thoughts on how to make this thing work?

Thanks so much!
Ryan--


--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.
 
Reply With Quote
 
 
 
 
pietlinden@hotmail.com
Guest
Posts: n/a
 
      25th Jan 2010
On Jan 25, 3:04*pm, ryguy7272 <ryguy7...@discussions.microsoft.com>
wrote:
> I’m working on a certain task, to copy data from one SubForm to another
> SubForm. *I know Access is not really designed for these kinds of things, but
> there is a legitimate reason for doing this; an offsetting position on
> options trades where all elements of data are almost exactly the same except
> for the put/call position. *
>


Stupid question, but why not just use a parameterized append query
and requery the subform that is based on the table you are appending
to? If you think of the forms as windows to your data, then skip the
windows and go straight for the tables underneath...
 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      25th Jan 2010
Ok, let's say I have 100 records. I go to record 101, add new data, and I
want to click a Button and a new Form, with accompnaying SubForm opens...will
the parameterized append query show me the record for 101 in the new
Form/SubForm? If yes, how do I set this up?

Thanks!
Ryan--

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"(E-Mail Removed)" wrote:

> On Jan 25, 3:04 pm, ryguy7272 <ryguy7...@discussions.microsoft.com>
> wrote:
> > I’m working on a certain task, to copy data from one SubForm to another
> > SubForm. I know Access is not really designed for these kinds of things, but
> > there is a legitimate reason for doing this; an offsetting position on
> > options trades where all elements of data are almost exactly the same except
> > for the put/call position.
> >

>
> Stupid question, but why not just use a parameterized append query
> and requery the subform that is based on the table you are appending
> to? If you think of the forms as windows to your data, then skip the
> windows and go straight for the tables underneath...
> .
>

 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      27th Jan 2010
Is there anything else to this? Am I missing something? it doesn't seem
like it should be a difficult thing, but actually it is turning out to be
kind of a difficult thing. Any other ideas as to how I may do this?

Thanks again,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"ryguy7272" wrote:

> Ok, let's say I have 100 records. I go to record 101, add new data, and I
> want to click a Button and a new Form, with accompnaying SubForm opens...will
> the parameterized append query show me the record for 101 in the new
> Form/SubForm? If yes, how do I set this up?
>
> Thanks!
> Ryan--
>
> --
> Ryan---
> If this information was helpful, please indicate this by clicking ''Yes''.
>
>
> "(E-Mail Removed)" wrote:
>
> > On Jan 25, 3:04 pm, ryguy7272 <ryguy7...@discussions.microsoft.com>
> > wrote:
> > > I’m working on a certain task, to copy data from one SubForm to another
> > > SubForm. I know Access is not really designed for these kinds of things, but
> > > there is a legitimate reason for doing this; an offsetting position on
> > > options trades where all elements of data are almost exactly the same except
> > > for the put/call position.
> > >

> >
> > Stupid question, but why not just use a parameterized append query
> > and requery the subform that is based on the table you are appending
> > to? If you think of the forms as windows to your data, then skip the
> > windows and go straight for the tables underneath...
> > .
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy data from 1 subform to another subform Theresa Microsoft Access Forms 2 21st Jul 2009 06:00 PM
copy data from one subform to another Simon Microsoft Access 1 3rd Jul 2008 12:22 AM
Copy Data from one Subform to another Subform Nigel King Microsoft Access Forms 2 4th Oct 2006 06:08 AM
Copy data from one subform into another =?Utf-8?B?SkthcmNobmVy?= Microsoft Access Form Coding 2 3rd Oct 2006 07:42 PM
copy data from one subform to another subform with recordset tag Microsoft Access VBA Modules 0 16th Sep 2003 05:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:07 AM.