Home > Ask the Domino Experts > Web Development and Downloads Questions & Answers > How do I pass attachments from one form to another using LS?
Ask The Domino Expert: Questions & Answers
EMAIL THIS

How do I pass attachments from one form to another using LS?

Jens Bruntt EXPERT RESPONSE FROM: Jens Bruntt

Pose a Question
Other Domino Categories
Meet all Domino Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 27 February 2004
How do I pass attachments from one form to another using LotusScript? I have script (see below), which works well for all number, date and text fields, but will not work for Rich Text. Basically I have a data input form on a page on the frameset, which is used to create documents in the background. Below is a shorten script that generates "Object Variable Not Set" on line "Call docT.CopyItem( tattach, 'attach' )".
Dim s As New notessession
Dim db As notesdatabase
Dim docT As notesdocument
 
Dim uiw As New notesuiworkspace
Dim uidoc As notesuidocument
 
Dim tcategory As String
Dim tattach As NotesItem
 
Set db = s.currentdatabase
Set uidoc = uiw.currentdocument
Call uidoc.refresh

tcategory = uidoc.fieldgettext
("tcategory")
Set tattach = docT.GetFirstItem
( "tattach" )
 
Set docT = db.createdocument
With docT
.form = "todo"
.category = tcategory
Call docT.CopyItem( tattach, "attach" )
End With

>
Your problem lies in you mixing background and foreground methods.

CopyItem is a LotusScript method for copying an item of the type NotesItem. A NotesItem is only available on a background document.

So your Call docT.CopyItem( tattach, "attach" ) is OK except for the bit where it says tattach. Tattach is not a reference to a NotesItem, it is a field on the foreground document -- the UIdoc.

What you need to do is something like this:

Call uidoc.Save
Dim backDoc As Notesdocument
Set backDoc = uidoc.Document
Dim tattachItem As NotesItem
Set tattachItem = backDoc.
GetFirstItem("tattach")
Call docT.CopyItem(tattachItem, "attach" )
I believe that this would do the trick.

Do you have comments on this Ask the Expert Q&A? Let us know.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Web Development and Downloads
Programmatically copy and hide attachments in Lotus Notes rich-text fields
Programmatically edit a rich-text field table from within the Lotus Notes client
Troubleshooting Lotus Notes Domino tabbed table problems
Verify Lotus Notes user access to Web pages
Can LotusScript agent display search results using specific view?
Creating Word doc from form works in Notes 5.0.2 but not 5.0.11
XML vs. JavaScript to fill in dropdown on form
Debugging Web agents
Configure an IM hot spot on Web page
Can I use PHP to change tables in MySQL DB running off Domino?

LotusScript
LotusScript agent parses ACL to Microsoft Notepad
LotusScript finds the first occurrence of a string from the right
Clear Recent Contacts view and prevent repopulation in Lotus Notes 8.x
Search Microsoft Active Directory with LotusScript
Three steps to trap and handle save conflicts with LotusScript
Troubleshoot agents by displaying LotusScript variables online
LotusScript sorts lists alphabetically
Run or restart Notes/Domino agents via text messages
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Lotus Notes Domino on Blackberry and mobile devices
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts