Solved

Printer Wont print till exit

Posted on 2001-08-08
7
207 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
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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

773 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