944,129 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Jul 30th, 2007
0

problem with report in notepad

Expand Post »
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 =
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
coco86 is offline Offline
35 posts
since Jul 2007
Jul 30th, 2007
0

Re: problem with report in notepad

Your problem is not clear.

Please explain it without giving the out put of the text file.
Reputation Points: 10
Solved Threads: 9
Junior Poster
AV Manoharan is offline Offline
166 posts
since Jun 2007
Jul 30th, 2007
0

Re: problem with report in notepad

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.....
Reputation Points: 10
Solved Threads: 0
Light Poster
coco86 is offline Offline
35 posts
since Jul 2007
Aug 1st, 2007
0

Re: problem with report in notepad

Click to Expand / Collapse  Quote originally posted by coco86 ...
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.....
Shell function, people use it for interactive mode. So writing to one notepad file will continue in operation until you abandon that shell. After that you have to activate the shell for the next notepad. It also will continue in interactive mode until stoped.

Anyhow, without seeing your piece of code, I won't be able to tell you where exactly the bug.

regards

AV Manoharan
Reputation Points: 10
Solved Threads: 9
Junior Poster
AV Manoharan is offline Offline
166 posts
since Jun 2007
Aug 1st, 2007
0

Re: problem with report in notepad

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
Reputation Points: 10
Solved Threads: 0
Light Poster
coco86 is offline Offline
35 posts
since Jul 2007
Aug 1st, 2007
0

Re: problem with report in notepad

Click to Expand / Collapse  Quote originally posted by coco86 ...
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
The streams are to be closed for further opening. so after

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
Reputation Points: 10
Solved Threads: 9
Junior Poster
AV Manoharan is offline Offline
166 posts
since Jun 2007
Aug 1st, 2007
0

Re: problem with report in notepad

Av Manoharan

Thnx for your help n respond, but I somehow couldnt get the file open with %SystemRoot%\system32\ , what exactly does it do ? dumping memory ? an error runtime 53 occured when I compile ..... any Idea?
Reputation Points: 10
Solved Threads: 0
Light Poster
coco86 is offline Offline
35 posts
since Jul 2007
Aug 1st, 2007
0

Re: problem with report in notepad

wait now i can run it ..... but the same problem occured .... " continous output " mayb your r right , we cannot stop it without pressing the stop button...
thnx AV Manoharan
Reputation Points: 10
Solved Threads: 0
Light Poster
coco86 is offline Offline
35 posts
since Jul 2007
Aug 1st, 2007
0

Re: problem with report in notepad

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?
Reputation Points: 10
Solved Threads: 0
Light Poster
coco86 is offline Offline
35 posts
since Jul 2007
Aug 2nd, 2007
0

Re: problem with report in notepad

ok i've used the above function, it can close my notepad but it still couldn't stop the process without pressing the stop button .... just wanna share ..
Reputation Points: 10
Solved Threads: 0
Light Poster
coco86 is offline Offline
35 posts
since Jul 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Data-Access with Vbasic
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: can we create database through vb in sqlite





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC