Hi
1. I have to disagree with Mike on the code.
KEYBOARD '{CTRL+F10}'
REPORT FORM myreport PREVIEW
This will not work, if the code iss from a forms print report button for example. KEYBOARD effect will get first executed with relevance to the container on which it is placed and the report form will get fired after that.
2. The following code will work..
oRepForm = CREATEOBJECT("FORM")
WITH oRepForm
.Caption = "Your Report"
.WindowState = 2
.Show()
ENDWITH
REPORT FORM rptFrxFile PREVIEW WINDOW (oRepForm.Name) ;
TO PRINTER PROMPT
oRepForm.Release()
RELEASE oRepForm
OR
3. More detailed way of solving it..
oRepForm = CREATEOBJECT("FORMPREVIEW")
WITH oRepForm
.Caption = "Your Report"
.WindowState = 2
.Show()
ENDWITH
REPORT FORM rptFrxFile PREVIEW WINDOW (oRepForm.Name) ;
TO PRINTER PROMPT
oRepForm.Release()
RELEASE oRepForm
**********************************
Make sure that the following is added at the end of your Main.prg or suitably so that the class is available for the aboce code.
**********************************
DEFINE CLASS formpreview AS form
ShowWindow = 1
DoCreate = .T.
Caption = "Form"
TitleBar = 1
WindowState = 2
Name = "formpreview"
ENDDEFINE
**********************************
____________________________________________
ramani - (Subramanian.G) 