Solved

Printer Wont print till exit

Posted on 2001-08-08
7
213 Views
Last Modified: 2012-05-04
When i goto print my hplj5 just waits until i exit the program ? Prints fine once printed any suggestions? I thought printer.newpage was like a page feed  was i wrong?
Also i noticed that the date structure doesnt always work. Sometimes the date will be within the two dates i chose in other part of program but they dont print out .



Private Sub Command1_Click()
Set Printer = Printers(0)
TODAYSDATE = Date
Debug.Print daysago
Open "u:\compfold\SAVEDATA.TXT" For Input As #1
For x = 1 To 100
If EOF(1) Then GoTo gohere3
Input #1, TECHS(x)
Input #1, CUST(x)
Input #1, TIMEIN(x)
Input #1, TIMEOUT(x)
Input #1, TIMELEAVE(x)
Input #1, DATES(x)
Input #1, phone(x)
Next
gohere3: Close #1: HOWMANYFILESOPENED = x
For x = 1 To HOWMANYFILESOPENED
 If DATES(x) >= Text1.Text Then
  If DATES(x) <= Text2.Text Then
     Printer.Print TECHS$(x), CUST(x), , TIMEIN(x), , TIMEOUT(x), TIMELEAVE(x), DATES(x)
 End If
 End If
Next
Printer.NewPage
thismanydays:
 End Sub
0
Comment
Question by:themmer650
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 32

Expert Comment

by:bhess1
ID: 6365884
You neglected a Printer.EndDoc statement to tell it you were done.
0
 
LVL 3

Expert Comment

by:Bahnass
ID: 6366493
Hi
 to make Date comparison I think U need to use date type vars or convert to

like
    Cdate(text1.text) instead of text1.text


0
 
LVL 3

Expert Comment

by:Bahnass
ID: 6366498
also
dime dates() as date
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:LuckyPhill
ID: 6366685
bhess1 you nailed it :)
0
 
LVL 32

Accepted Solution

by:
bhess1 earned 50 total points
ID: 6369532
bahnass has the basic correct answer for the date issue.  Consider these text dates:

5/1/2001
5/2/2001
05/03/2001
5/19/2001
5/20/2001

When sorted *As Text*, they will list in this order:
05/03/2001
5/1/2001
5/19/2001
5/2/2001
5/20/2001

Thus, 04/03/2001 is less than (before) 4/1/2001 and 4/2/2001.

Your date comparisons can be quickly rewritten as:
If CDate(DATES(x)) >= CDate(Text1.Text) Then
 If CDate(DATES(x)) <= CDate(Text2.Text) Then

Or, you can place the values into DATE type variables:

Dim DATES(1 to 100) As Date
Dim Dt1 As Date
Dim Dt2 As Date
....
gohere3: Close #1: HOWMANYFILESOPENED = x
Dt1 = CDate(Text1.Text)
Dt2 = CDate(Text2.Text)
For x = 1 To HOWMANYFILESOPENED
If DATES(x) >= Dt1 Then
 If DATES(x) <= Dt2 Then
   
0
 
LVL 3

Expert Comment

by:andysalih
ID: 6370941
PRINTER.ENDDOC is bang on.

somebody already quoted this.

add that at the end and prestow,


cheers
andy

ps dont give me the points i was just reiterating
0
 
LVL 3

Expert Comment

by:Bahnass
ID: 6371575
Thanks bhess1

I didn't have time to explain
but I think I would not explain it better

( if points R to be devided EndDoc , bhess1 ,... me)
thanks 4 all of U
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Validating VB6 Function 19 68
How to measure sizes and angles in scanned images ? 3 89
Set email body to html using vbscript 6 71
RUNRMTCMD from AS/400 13 101
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question