| | |
problem with report in notepad
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jul 2007
Posts: 35
Reputation:
Solved Threads: 0
i have a prob, when the report is written in a notepad, i can only click on stop button then click play again to stop the the report to write in a sequence .... need help on it how to break the sequence without pressing the stop button....
C:\Documents and Settings\T070702\Desktop\02B01P0600679FN.dat
--------------------------------------------------------------
Error Record = Record Count is mismatch
Error Line =
Error Line =
Error Line =
Error Line =
Debit Purse is not match
Debit Non Purse is not match
Hash Total Purse is not match
Hash Total NonPurse is not match
C:\Documents and Settings\T070702\Desktop\04P32P1004099FN.dat
--------------------------------------------------------------
Error Record = Error
Error Line = mfgNo line =11 mfgNo line =15 mfgNo line =19 mfgNo line =778 mfgNo line =780
Error Line = crdtraNo line =780
Error Line =
Error Line =
C:\Documents and Settings\T070702\Desktop\02B01P0600679FN.dat
--------------------------------------------------------------
Error Record = Record Count is mismatch
Error Line =
Error Line =
Error Line =
Error Line =
Debit Purse is not match
Debit Non Purse is not match
Hash Total Purse is not match
Hash Total NonPurse is not match
C:\Documents and Settings\T070702\Desktop\04P32P1004099FN.dat
--------------------------------------------------------------
Error Record = Error
Error Line = mfgNo line =11 mfgNo line =15 mfgNo line =19 mfgNo line =778 mfgNo line =780
Error Line = crdtraNo line =780
Error Line =
Error Line =
•
•
Join Date: Jul 2007
Posts: 35
Reputation:
Solved Threads: 0
well i thought tat it would be easier since im not good in explaining.... anyway i 'll try.... the writing in the notepad is continous while i want it to be in two different notepad ... or i cannot stop the shell function....... without pressing the stop button...... haiyo i really bad in explaining.....
•
•
Join Date: Jun 2007
Posts: 166
Reputation:
Solved Threads: 9
•
•
•
•
well i thought tat it would be easier since im not good in explaining.... anyway i 'll try.... the writing in the notepad is continous while i want it to be in two different notepad ... or i cannot stop the shell function....... without pressing the stop button...... haiyo i really bad in explaining.....
Anyhow, without seeing your piece of code, I won't be able to tell you where exactly the bug.
regards
AV Manoharan
•
•
Join Date: Jul 2007
Posts: 35
Reputation:
Solved Threads: 0
yea i think so . thnx... u 've answered it. anyway this is the code
Private Sub CmdChkFile_Click()
Dim fs As FileSystemObject
Dim ts As TextStream, ts1 As TextStream, ts2 As TextStream
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(DatFName, ForReading)
Set ts1 = fs.OpenTextFile(HdrFName, ForReading)
Set ts2 = fs.CreateTextFile(DatFName & "_" & Format(Date, "ddmmyy") & ".rpt")
Dim MyVar As String, MyCheck As String
Dim line As Integer, totalline As Integer, i As Integer
Dim SumCP, SumCN, SumDP, SumDN
Dim HashTPurse, HashTNPurse
Do While Not ts.AtEndOfStream
d = ts.ReadLine
Call tracingFNDat(Mystring)
'function '
line = line + 1
If Trim(Mfgno) = "" Then lbl2.Caption = lbl2.Caption & " mfgNo line =" & line
If Trim(CardTran) = "" Then lbl3.Caption = lbl3.Caption & " crdtraNo line =" & line
totalline = line
Loop
Do While Not ts1.AtEndOfStream
h = ts1.ReadLine
Call tracingFNHdr(Mystring)
Loop
If Trim(RecordCount) <> totalline Then lbl1.Caption = "-BV03- Record Count is mismatch"
If totalline = 0 Then lbl1.Caption = " -BV10- Record Error "
If Val(CP) <> SumCP Then lbl8.Caption = lbl8.Caption & " -BV04- Credit Purse mismatch"
If Val(DP) <> SumDP Then lbl9.Caption = lbl9.Caption & " -BV04- Debit Purse mismatch"
If Val(CN) <> SumCN Then lbl10.Caption = " -BV05- Credit Non Purse mismatch"
HashTPurse = SumCP - SumDP
HashTNPurse = SumCN - SumDN
'Writing'
vmsg = vmsg & DatFName & Chr$(13) & Chr$(10) & _
"--------------------------------------------------------------" & Chr$(13) & Chr$(10) & _
"Error Record = " & lbl1.Caption & Chr$(13) & Chr$(10) & _
"Error Line = " & lbl2.Caption & Chr$(13) & Chr$(10) & _
"Error Line = " & lbl3.Caption & Chr(13) & Chr$(10) & _
"Error Line = " & lbl4.Caption & Chr(13) & Chr$(10) & _
"Error Line = " & lbl5.Caption & Chr(13) & Chr$(10) & _
lbl8.Caption & Chr$(13) & Chr$(10) & _
lbl9.Caption & Chr$(13) & Chr$(10) & _
lbl10.Caption & Chr$(13) & Chr$(10) & _
lbl11.Caption & Chr$(13) & Chr$(10) & _
lbl12.Caption & Chr$(13) & Chr$(10) & _
lbl13.Caption & Chr$(13) & Chr$(10) _
& Chr$(13) & Chr$(10) & Chr$(13) & Chr$(10) _
& Chr$(13) & Chr$(10) & Chr$(13) & Chr$(10) _
ts2.WriteLine (vmsg)
Call Shell("notepad.exe " & (DatFName & "_" & Format(Date, "ddmmyy") & ".rpt"), ForReading)
is there anyway to close this notepad??? that's what im thinking actually... anyway millions of thank you
End Sub
Private Sub CmdChkFile_Click()
Dim fs As FileSystemObject
Dim ts As TextStream, ts1 As TextStream, ts2 As TextStream
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(DatFName, ForReading)
Set ts1 = fs.OpenTextFile(HdrFName, ForReading)
Set ts2 = fs.CreateTextFile(DatFName & "_" & Format(Date, "ddmmyy") & ".rpt")
Dim MyVar As String, MyCheck As String
Dim line As Integer, totalline As Integer, i As Integer
Dim SumCP, SumCN, SumDP, SumDN
Dim HashTPurse, HashTNPurse
Do While Not ts.AtEndOfStream
d = ts.ReadLine
Call tracingFNDat(Mystring)
'function '
line = line + 1
If Trim(Mfgno) = "" Then lbl2.Caption = lbl2.Caption & " mfgNo line =" & line
If Trim(CardTran) = "" Then lbl3.Caption = lbl3.Caption & " crdtraNo line =" & line
totalline = line
Loop
Do While Not ts1.AtEndOfStream
h = ts1.ReadLine
Call tracingFNHdr(Mystring)
Loop
If Trim(RecordCount) <> totalline Then lbl1.Caption = "-BV03- Record Count is mismatch"
If totalline = 0 Then lbl1.Caption = " -BV10- Record Error "
If Val(CP) <> SumCP Then lbl8.Caption = lbl8.Caption & " -BV04- Credit Purse mismatch"
If Val(DP) <> SumDP Then lbl9.Caption = lbl9.Caption & " -BV04- Debit Purse mismatch"
If Val(CN) <> SumCN Then lbl10.Caption = " -BV05- Credit Non Purse mismatch"
HashTPurse = SumCP - SumDP
HashTNPurse = SumCN - SumDN
'Writing'
vmsg = vmsg & DatFName & Chr$(13) & Chr$(10) & _
"--------------------------------------------------------------" & Chr$(13) & Chr$(10) & _
"Error Record = " & lbl1.Caption & Chr$(13) & Chr$(10) & _
"Error Line = " & lbl2.Caption & Chr$(13) & Chr$(10) & _
"Error Line = " & lbl3.Caption & Chr(13) & Chr$(10) & _
"Error Line = " & lbl4.Caption & Chr(13) & Chr$(10) & _
"Error Line = " & lbl5.Caption & Chr(13) & Chr$(10) & _
lbl8.Caption & Chr$(13) & Chr$(10) & _
lbl9.Caption & Chr$(13) & Chr$(10) & _
lbl10.Caption & Chr$(13) & Chr$(10) & _
lbl11.Caption & Chr$(13) & Chr$(10) & _
lbl12.Caption & Chr$(13) & Chr$(10) & _
lbl13.Caption & Chr$(13) & Chr$(10) _
& Chr$(13) & Chr$(10) & Chr$(13) & Chr$(10) _
& Chr$(13) & Chr$(10) & Chr$(13) & Chr$(10) _
ts2.WriteLine (vmsg)
Call Shell("notepad.exe " & (DatFName & "_" & Format(Date, "ddmmyy") & ".rpt"), ForReading)
is there anyway to close this notepad??? that's what im thinking actually... anyway millions of thank you
End Sub
•
•
Join Date: Jun 2007
Posts: 166
Reputation:
Solved Threads: 9
•
•
•
•
yea i think so . thnx... u 've answered it. anyway this is the code
Private Sub CmdChkFile_Click()
Dim fs As FileSystemObject
Dim ts As TextStream, ts1 As TextStream, ts2 As TextStream
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile(DatFName, ForReading)
Set ts1 = fs.OpenTextFile(HdrFName, ForReading)
Set ts2 = fs.CreateTextFile(DatFName & "_" & Format(Date, "ddmmyy") & ".rpt")
Dim MyVar As String, MyCheck As String
Dim line As Integer, totalline As Integer, i As Integer
Dim SumCP, SumCN, SumDP, SumDN
Dim HashTPurse, HashTNPurse
Do While Not ts.AtEndOfStream
d = ts.ReadLine
Call tracingFNDat(Mystring)
'function '
line = line + 1
If Trim(Mfgno) = "" Then lbl2.Caption = lbl2.Caption & " mfgNo line =" & line
If Trim(CardTran) = "" Then lbl3.Caption = lbl3.Caption & " crdtraNo line =" & line
totalline = line
Loop
Do While Not ts1.AtEndOfStream
h = ts1.ReadLine
Call tracingFNHdr(Mystring)
Loop
If Trim(RecordCount) <> totalline Then lbl1.Caption = "-BV03- Record Count is mismatch"
If totalline = 0 Then lbl1.Caption = " -BV10- Record Error "
If Val(CP) <> SumCP Then lbl8.Caption = lbl8.Caption & " -BV04- Credit Purse mismatch"
If Val(DP) <> SumDP Then lbl9.Caption = lbl9.Caption & " -BV04- Debit Purse mismatch"
If Val(CN) <> SumCN Then lbl10.Caption = " -BV05- Credit Non Purse mismatch"
HashTPurse = SumCP - SumDP
HashTNPurse = SumCN - SumDN
'Writing'
vmsg = vmsg & DatFName & Chr$(13) & Chr$(10) & _
"--------------------------------------------------------------" & Chr$(13) & Chr$(10) & _
"Error Record = " & lbl1.Caption & Chr$(13) & Chr$(10) & _
"Error Line = " & lbl2.Caption & Chr$(13) & Chr$(10) & _
"Error Line = " & lbl3.Caption & Chr(13) & Chr$(10) & _
"Error Line = " & lbl4.Caption & Chr(13) & Chr$(10) & _
"Error Line = " & lbl5.Caption & Chr(13) & Chr$(10) & _
lbl8.Caption & Chr$(13) & Chr$(10) & _
lbl9.Caption & Chr$(13) & Chr$(10) & _
lbl10.Caption & Chr$(13) & Chr$(10) & _
lbl11.Caption & Chr$(13) & Chr$(10) & _
lbl12.Caption & Chr$(13) & Chr$(10) & _
lbl13.Caption & Chr$(13) & Chr$(10) _
& Chr$(13) & Chr$(10) & Chr$(13) & Chr$(10) _
& Chr$(13) & Chr$(10) & Chr$(13) & Chr$(10) _
ts2.WriteLine (vmsg)
Call Shell("notepad.exe " & (DatFName & "_" & Format(Date, "ddmmyy") & ".rpt"), ForReading)
is there anyway to close this notepad??? that's what im thinking actually... anyway millions of thank you
End Sub
ts2.writeline(vmsg)
you close both by
ts.close and ts2.close
then open it as below.
Dim MyNote1 As String
MyNote1 ="%SystemRoot%\system32\notepad.exe " & (DatFname1 & .....etc. then
Shell MyNote1, vbMaximizedFocus
See, I did not test it. But the above logic is very correct.
Rest is up to you.
Happy Programming
AV Manoharan
•
•
Join Date: Jul 2007
Posts: 35
Reputation:
Solved Threads: 0
I've just received this ... they said it can stop it ...
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_CLOSE = &H10
Public Function callfun()
Shell "C:\RSSB.exe 1", vbMaximizedFocus
End Function
Public Function clsExe()
Dim winHwnd As Long
Dim RetVal As Long
winHwnd = FindWindow(vbNullString, "RSSB")
If winHwnd <> 0 Then
' MsgBox "calc is closing"
PostMessage winHwnd, WM_CLOSE, 0&, 0&
Else
'MsgBox "The Calculator is not open."
End If
End Function
Do you have any Idea about this?
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Const WM_CLOSE = &H10
Public Function callfun()
Shell "C:\RSSB.exe 1", vbMaximizedFocus
End Function
Public Function clsExe()
Dim winHwnd As Long
Dim RetVal As Long
winHwnd = FindWindow(vbNullString, "RSSB")
If winHwnd <> 0 Then
' MsgBox "calc is closing"
PostMessage winHwnd, WM_CLOSE, 0&, 0&
Else
'MsgBox "The Calculator is not open."
End If
End Function
Do you have any Idea about this?
![]() |
Similar Threads
- problem in exporting crystal report (ASP.NET)
- Report Header Problem (MS SQL)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Data-Access with Vbasic
- Next Thread: can we create database through vb in sqlite
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





