Solved

Printer Wont print till exit

Posted on 2001-08-08
7
202 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now