Home > Software engineering >  If Me. WindowState <> vbMinimized And fMainForm. WindowState <> vbMinimized The
If Me. WindowState <> vbMinimized And fMainForm. WindowState <> vbMinimized The

Time:09-20



 'to refresh the formPublic Sub RecordRefresh () 
'set the msSql
MsSql=msSelect & amp; MsTableName & amp; "Where kqdate>='" & amp; Format (DateAdd (" m ", 1, Now), "yyyy - mm - dd) & amp; "' and kqdate<='" & amp; Format (Now, "yyyy - mm - dd) & amp; "'" & amp; MsOrderBy

'display data
MsBarText="current data time range:" & amp; Format (DateAdd (" m ", 1, Now), "yyyy - mm - dd) & amp; "To" & amp; Format (Now, "yyyy - mm - dd")
ShowData
SOrder0="+ {kqdate}
"SOrder1=""

End Sub

Consult the real-time error 91 If Me. WindowState & lt;> VbMinimized And fMainForm. WindowState & lt;> VbMinimized Then

CodePudding user response:

All commented On the Error Resume Next statement, in VB6 IDE,
The error and then click the debugging, the cursor will stop error in the statement,
Or
In doubt may have a logical error statements in advance to set breakpoints, run through the breakpoint interrupt,

At this point can be used in the immediate window
? The variable name
Or
? The function name () function parameter
Or
Process (parameters)
Auxiliary debugging,

CodePudding user response:

Thank you very much! The effect is very good, smooth skip this program errors,
. CrptPrint method was not found or data members consult...
 'plan hair base pay 
Public Sub WageOne ()

Dim sSql As String

On Error GoTo myErr
With fMainForm
'set menus and toolbars
'mnufile. Enabled=False
'mnuRecord. Enabled=False
'mnuMan. Enabled=False
'mnuBonus. Enabled=False
'mnuCar. Enabled=False
'mnuMater. Enabled=False
'mnuWork. Enabled=False
'mnuWindow. Enabled=False
'mnuSysEdit. Enabled=False
'mnuPreview. Enabled=False
'mnuPrint. Enabled=False
'mnuWage. Enabled=False
'tbToolBar. Enabled=False

End With

With fMainForm. CrptPrint

'set the connection string
. Connect=gsCon
'set the print report file
. ReportFileName=App. Path & amp; "\ RPT \ one RPT"

'sort
SortFields (0)=sOrder0
SortFields (1)=sOrder1

'the number of specified print
SSql=msSql
This=Left (sSql, InStr (1, sSql, "order by") - 2)
. PrinterStartPage=0
. PrinterStopPage=1
. CopiesToPrinter=1
'set the print preview window for frmPreview child form
. WindowParentHandle=frmPreview. HWnd
FrmPreview. Show

'set the print way

The Destination=PREVIEWMODE
The Action=PREVIEWMODE
End With

MyErr:
ShowError
End Sub
  • Related