Hot Topic (More than 10 Replies) Subform cell copy/capture (Read 1392 times)
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Subform cell copy/capture
Jul 12th, 2010 at 12:19pm
Print Post Print Post  
Is there a way to copy or capture the data from a subform cell while in the parent form?  In other words while working in a form I want to be able to click on a cell in the subform and then click on a command button that would show a writeln window with the contents of that cell.  I was unsuccessful finding code for this. I’ve tried making a macro that would copy the contents of the cell but can't seem to make it work. I thought that if I could get the cell data to the clipboard I could use WriteLn(@GetSelectionContents()) to show me the contents.  The reason that I want to copy the cell data is so that I can use it in a search.

Any thoughts would be appreciated.  
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Subform cell copy/capture
Reply #1 - Jul 12th, 2010 at 12:29pm
Print Post Print Post  
You can put the value into a ClientLocalValue and it will then be available from anywhere.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: Subform cell copy/capture
Reply #2 - Jul 12th, 2010 at 1:39pm
Print Post Print Post  
Thanks Erika,

How do I get ClientLocalValue to recognize the cell in the subform that I click on?
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Subform cell copy/capture
Reply #3 - Jul 12th, 2010 at 2:57pm
Print Post Print Post  
tcgeo wrote on Jul 12th, 2010 at 1:39pm:
Thanks Erika,

How do I get ClientLocalValue to recognize the cell in the subform that I click on?


Sounds like you'd need to make use of On Element Entry to put the value you want into a ClientLocalValue. What exactly are you trying to accomplish with this, Brandon?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: Subform cell copy/capture
Reply #4 - Jul 12th, 2010 at 3:18pm
Print Post Print Post  
Hi Erika,

The client wants to be able to click on an invoice number shown in a subform record which then would pull up that invoice.
  
Back to top
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Subform cell copy/capture
Reply #5 - Jul 12th, 2010 at 3:28pm
Print Post Print Post  
tcgeo wrote on Jul 12th, 2010 at 3:18pm:
Hi Erika,

The client wants to be able to click on an invoice number shown in a subform record which then would pull up that invoice.


That may be too aggressive and have them opening invoices when they are just trying to navigate the subform. I'd recommend you put a command button on the parent form that offers a list of the invoice numbers in the subform for Client to select and open the one they pick. If that won't do, then put a separate unbound field in the subform with On Element Change programming that opens the invoice if Client types an X or something in the field and presses Enter to leave the field.
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Subform cell copy/capture
Reply #6 - Jul 12th, 2010 at 3:31pm
Print Post Print Post  
You could use something like the following in the On Element Entry event for every LE (field) in the subform:
ClientLocalValue("SubformValue", ThisElement)

Then, put this in the command button's On Element Entry event in the parent form:
WriteLn( @ClientLocalValue("SubformValue") )

This will allow you to click on any cell in the subform, and then click on the command button to make the subform values display in the slate (WriteLn window).
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: Subform cell copy/capture
Reply #7 - Jul 12th, 2010 at 3:36pm
Print Post Print Post  
"put a separate unbound field in the subform with On Element Change programming that opens the invoice if Client types an X or something in the field and presses Enter to leave the field"

I think that will be a great solution, I'll give it a go.

Thank you.
  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Subform cell copy/capture
Reply #8 - Jul 12th, 2010 at 3:45pm
Print Post Print Post  
tcgeo wrote on Jul 12th, 2010 at 3:18pm:
The client wants to be able to click on an invoice number shown in a subform record which then would pull up that invoice.

Well, in that case you could modify my suggestion by putting the first portion in the subform's (not the field's) On Element Entry event, and change it to something like ClientLocalValue("SubformInvNo", InvNo).

Then the command button could grab that value, and fetch the desired record from there.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
tcgeo
Full Member
***
Offline



Posts: 278
Location: Traverse City, Michigan
Joined: May 13th, 2008
Re: Subform cell copy/capture
Reply #9 - Jul 12th, 2010 at 4:11pm
Print Post Print Post  
Wow Carl, that's a beautiful thing!

Works perfectly! What great thinking to do this: ClientLocalValue("SubformValue", ThisElement) in the subform elements. Have you done this before?  

Thank you very much.
  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Subform cell copy/capture
Reply #10 - Jul 12th, 2010 at 5:03pm
Print Post Print Post  
tcgeo wrote on Jul 12th, 2010 at 4:11pm:
Have you done this before?.

Not using it exactly like that, but it's part of a more complex function (which I may publish in Inside Sesame at some point).
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged