Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing problem

Status
Not open for further replies.

Namlop

Programmer
Nov 8, 2002
36
0
0
NL
Hi,

I've got a problem.
I want to clear the rowsource of a listbox directly after i've printed the form that contains that listbox.
But when i clear the rowsource it returns an error(2191).

Since this is a procedure that has to be repeated more then 50 times, using a messagebox directly after the print command (before clearing the rowsource), is not really an option.

Has anyone got any ideas how to solve this problem?
 
Private Sub afdrukken_Click()
On Error GoTo Err_afdrukken_Click

Dim teller As Integer
For teller = 0 To 51
DoCmd.PrintOut acSelection
DoCmd.GoToRecord , , acNext
Next teller

Exit_afdrukken_Click:
Exit Sub

Err_afdrukken_Click:
MsgBox Err.Description
Resume Exit_afdrukken_Click

End Sub

Because of the line 'DoCmd.GoToRecord , , acNext' the if statement in the timer is true

Private Sub Form_Timer()
If ChangeCheck <> Tekstvak_Bedrijfsdeel.Value Then
Keuzelijst_bron.Requery
VulForm
End If
End Sub


Private Sub VulForm()
Dim Lijst, Locatie, nieuwLijst, bedrijfNr As String
Dim teller, xtrateller As Integer
Dim bestaat As Boolean
tijdTeller = 0
bestaat = False
aantalLocaties = 0

Keuzelijst_begroot.RowSource = &quot;&quot;
Keuzelijst_jan.RowSource = &quot;&quot;
Keuzelijst_feb.RowSource = &quot;&quot;
Keuzelijst_mrt.RowSource = &quot;&quot;
Keuzelijst_apr.RowSource = &quot;&quot;
Keuzelijst_mei.RowSource = &quot;&quot;
Keuzelijst_jun.RowSource = &quot;&quot;
Keuzelijst_jul.RowSource = &quot;&quot;
Keuzelijst_aug.RowSource = &quot;&quot;
Keuzelijst_sep.RowSource = &quot;&quot;
Keuzelijst_okt.RowSource = &quot;&quot;
Keuzelijst_nov.RowSource = &quot;&quot;
Keuzelijst_dec.RowSource = &quot;&quot;
Keuzelijst_Locaties.RowSource = &quot;&quot;
Keuzelijst_Locaties.RowSourceType = &quot;Table/query&quot;

....etc (it's a rather large function)

but i get the error on Keuzelijst_begroot.RowSource = &quot;&quot;


 
The problem is (i think) that it the print job has to be completed before the function VulForm is called. But since VulForm is called from the timer, i think the print job has to be completed before i go to the next record
 
Let me rephrase the question.

After the line DoCmd.PrintOut acSelection the program has to wait before going futher with the next code line until the page has been printed.

Is this possible?
I love work.
I can just sit and look at it for hours.
 
I figured out what the problem was.

I had to set the timerinterval to zero before i started printing.

I love work.
I can just sit and look at it for hours.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top