• 0

What is wrong with this coding?


Question

Private Sub cmdPrint_Click()

cmdPrint.Visible = False

frmInvoice.PrintForm

cmdPrint.Visible = True

End Sub

???????????????????????????????

this is for my 'print invoice' command button but when i run the program in VB6( i have to use this for my A Level corse, so plz no reply's saying its an old program because i know) i get the following message :"compile error : variable not defined", and the "Private Sub cmdPrint_Click()" is highlighted in yellow + "frmInvoice" is highlighted in blue. what does this mean and how can i fix it?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
Private Sub cmdPrint_Click()

cmdPrint.Visible = False

frmInvoice.PrintForm

cmdPrint.Visible = True

End Sub

???????????????????????????????

this is for my 'print invoice' command button but when i run the program in VB6( i have to use this for my A Level corse, so plz no reply's saying its an old program because i know) i get the following message :"compile error : variable not defined", and the "Private Sub cmdPrint_Click()" is highlighted in yellow + "frmInvoice" is highlighted in blue. what does this mean and how can i fix it?

where is the code? perhaps changing the private to public may help your situation (If I remember my VB6 correctly)

Link to comment
Share on other sites

  • 0
where is the code? perhaps changing the private to public may help your situation (If I remember my VB6 correctly)

the code is :

Private Sub cmdPrint_Click()

cmdPrint.Visible = False

frmInvoice.PrintForm

cmdPrint.Visible = True

End Sub

i tryed changing it to public and no luck =/

Link to comment
Share on other sites

  • 0

I have no experience with VB6.

Where are frmInvoice and cmdPrint defined? If it is not before the function you may need to pass them to it.

Also you (apparently) need to define variables using Dim, have you done this?

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.