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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
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 |