This is for the Client. Sorry it would not let me pick that on the category.
I have searched the forum and help, but have not come up with any answers.
I have the following code that works, except that it does not copy the correct field.
I want it to grab information from a Computed when composed field called AcctCode.
Instead this code is copying the information from the first field on the form called ProjectNum.
What am I doing wrong???
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
uidoc.EditMode = True
Call uidoc.GotoField("AcctCode")
Call uidoc.SelectAll
Call uidoc.Copy
Call uidoc.DeselectAll
uidoc.EditMode = False
End Sub
Thanks for any and all help,
Teri
Subject: LS – Copying information from wrong field.
I’m surprised you didn’t get an error since the GotoField method can’t place the cursor in the CWC AcctCode field. But if you are trying to copy a value to the clipboard, here’s a tip posted a while back:
http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/073e9283af20e3188525702f007535ad?OpenDocument
Hope that helps.
Subject: RE: LS – Copying information from wrong field.
Wing,
Thanks for the response. I saw that posting but since I am not very good with LS (I use it very seldon), I was not sure where to insert my field at in the line of code you linked to.
I guess I will have to try to read through that code to find where to place my field.
Teri
Subject: RE: LS – Copying information from wrong field.
Teri,
ideally you would copy Dallas’ code into a script library that you could reference from other places within your application and be able to copy it out to other databases if need be. But if you are not familiar with the use of script libraries and this is the only place you would use this code, the “quick and dirty” thing to do is:
-
copy all of Dallas’ code (from his " '// W32 API declares" comment to the “End Function”)
-
place your cursor in the Declarations area of your button an paste the code
You will see two functions added to your button’s LotusScript: getClipboardText and setClipboardText.
You button code would be amended to something like this:
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Call setClipboardText(doc.AcctCode(0))
End Sub
I’m not sure what you plan on doing with the contents of AcctCode after it has been placed into the clipboard. If you plan on retrieving AcctCode from the clipboard via LS, just use the getClipboardText function.
Hope that helps.
Subject: RE: LS – Copying information from wrong field.
Thanks Wing,
This works beautifully. I will start to look at script libraries and of course review the code so that I can learn what exactly was done.
I understand that the originally code was failing due to this being a CWC field, and after you had pointed that out I am suprised it didn’t throw an error as well.
Thanks again,
Teri