Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Printer Wont print till exit

Posted on 2001-08-08
7
Medium Priority
?
239 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:Brendt Hess
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
Technology Partners: 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:
Brendt Hess earned 150 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

916 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