A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Report Run-Time Error



 
 
Thread Tools Display Modes
  #1  
Old February 13th, 2006, 02:13 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Report Run-Time Error

Hi All,

Any assistance will be appreciated.

I have a subform "frmpayments" within a form "frminvoice" and a command
button opening a report "rptInvoice", the problem is if there is no payment
or record on the "frmpayments" when i click on the command button i get a
Run-Time Error '2427'.

It appears there must be a record in the subform "frmPayments" OR i'm hoping
there maybe an alternative.

The Run-Time Error refers to the following when i click on Debug, which of
course works perfectly when there's a record in subfrom "frmPayments".

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Debtor.Value = 2 Then
Me.AccountsName.Visible = False
Me.AccountsAddress.Visible = False
Me.AccountsSuburb.Visible = False
Me.InvoiceOwner.Visible = True
Me.InvoiceAddress.Visible = True
Me.InvoiceSuburb.Visible = True
Else
Me.AccountsName.Visible = True
Me.AccountsAddress.Visible = True
Me.AccountsSuburb.Visible = True
Me.InvoiceOwner.Visible = False
Me.InvoiceAddress.Visible = False
Me.InvoiceSuburb.Visible = False
End If
End Sub

  #2  
Old February 13th, 2006, 06:35 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Report Run-Time Error

You might try wrap your code in HasData to see


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.HasData Then
If Me.Debtor.Value = 2 Then
Me.AccountsName.Visible = False
Me.AccountsAddress.Visible = False
Me.AccountsSuburb.Visible = False
Me.InvoiceOwner.Visible = True
Me.InvoiceAddress.Visible = True
Me.InvoiceSuburb.Visible = True
Else
Me.AccountsName.Visible = True
Me.AccountsAddress.Visible = True
Me.AccountsSuburb.Visible = True
Me.InvoiceOwner.Visible = False
Me.InvoiceAddress.Visible = False
Me.InvoiceSuburb.Visible = False
End If
End If
End Sub


--
Duane Hookom
MS Access MVP


"Greg" wrote in message
...
Hi All,

Any assistance will be appreciated.

I have a subform "frmpayments" within a form "frminvoice" and a command
button opening a report "rptInvoice", the problem is if there is no
payment
or record on the "frmpayments" when i click on the command button i get a
Run-Time Error '2427'.

It appears there must be a record in the subform "frmPayments" OR i'm
hoping
there maybe an alternative.

The Run-Time Error refers to the following when i click on Debug, which of
course works perfectly when there's a record in subfrom "frmPayments".

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Debtor.Value = 2 Then
Me.AccountsName.Visible = False
Me.AccountsAddress.Visible = False
Me.AccountsSuburb.Visible = False
Me.InvoiceOwner.Visible = True
Me.InvoiceAddress.Visible = True
Me.InvoiceSuburb.Visible = True
Else
Me.AccountsName.Visible = True
Me.AccountsAddress.Visible = True
Me.AccountsSuburb.Visible = True
Me.InvoiceOwner.Visible = False
Me.InvoiceAddress.Visible = False
Me.InvoiceSuburb.Visible = False
End If
End Sub



  #3  
Old February 13th, 2006, 09:52 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Report Run-Time Error

Duane,

Thanks for that! Problem solved and it also solved a similar problem in
another area of my database.

Cheers,


Greg.




"Duane Hookom" wrote:

You might try wrap your code in HasData to see


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.HasData Then
If Me.Debtor.Value = 2 Then
Me.AccountsName.Visible = False
Me.AccountsAddress.Visible = False
Me.AccountsSuburb.Visible = False
Me.InvoiceOwner.Visible = True
Me.InvoiceAddress.Visible = True
Me.InvoiceSuburb.Visible = True
Else
Me.AccountsName.Visible = True
Me.AccountsAddress.Visible = True
Me.AccountsSuburb.Visible = True
Me.InvoiceOwner.Visible = False
Me.InvoiceAddress.Visible = False
Me.InvoiceSuburb.Visible = False
End If
End If
End Sub


--
Duane Hookom
MS Access MVP


"Greg" wrote in message
...
Hi All,

Any assistance will be appreciated.

I have a subform "frmpayments" within a form "frminvoice" and a command
button opening a report "rptInvoice", the problem is if there is no
payment
or record on the "frmpayments" when i click on the command button i get a
Run-Time Error '2427'.

It appears there must be a record in the subform "frmPayments" OR i'm
hoping
there maybe an alternative.

The Run-Time Error refers to the following when i click on Debug, which of
course works perfectly when there's a record in subfrom "frmPayments".

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Debtor.Value = 2 Then
Me.AccountsName.Visible = False
Me.AccountsAddress.Visible = False
Me.AccountsSuburb.Visible = False
Me.InvoiceOwner.Visible = True
Me.InvoiceAddress.Visible = True
Me.InvoiceSuburb.Visible = True
Else
Me.AccountsName.Visible = True
Me.AccountsAddress.Visible = True
Me.AccountsSuburb.Visible = True
Me.InvoiceOwner.Visible = False
Me.InvoiceAddress.Visible = False
Me.InvoiceSuburb.Visible = False
End If
End Sub




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Parameter thru Form Dialog Box for REPORT Sandy Setting Up & Running Reports 16 January 10th, 2006 10:06 AM
Reporting subreport total on main report BobV Setting Up & Running Reports 22 November 1st, 2005 03:19 AM
Help! I'm getting error messages too much-can't open Resume Wizard LizLB General Discussion 0 May 3rd, 2005 01:46 AM
Use first record found in expression? CASJAS Running & Setting Up Queries 17 July 22nd, 2004 09:21 PM
Continual Error 1321 Trying to Install Office 2003 Chad Harris General Discussions 9 June 11th, 2004 08:19 AM


All times are GMT +1. The time now is 01:10 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.