Solved

Printer Wont print till exit

Posted on 2001-08-08
7
216 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

734 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