Open a form or document

Hello All,

I have a action button in a view. when I click that it should open a document if it already created on that current day I mean the same day, if its not created it should open the respective form for creating a new document.

I tried few but it dint work for me. Kindly help me guys.

Regards

Madhan

Subject: Open a form or document

I suppose you have a view with the documents. Try to find the document with the correct key(day). If it exists open it else create a new one, like in

Set View = CurDb.GetView(“name of view”)

Set Doc = View.GetDocumentByKey(key, True)

If Doc Is Nothing Then

Set UIDoc = WS.ComposeDocument( CurDb.Server , CurDb.FileName , Formname)

Else

Call WS.EditDocument(True, Doc)

End if

If you don’t have a view do a search