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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

#Error in custom function



 
 
Thread Tools Display Modes
  #1  
Old August 14th, 2006, 06:00 PM posted to microsoft.public.access.queries
Kirk P.
external usenet poster
 
Posts: 84
Default #Error in custom function

I've got this function that returns good results except for some records
return #Error. This #Error is expected, and I'm trying to trap it and report
the record as "9: Function Group Not Defined". What am I doing wrong?


If [FuncGroup] = "Operations" Then
RowDesig2 = "3: DIRECT OPS EXPENSE"

ElseIf [FuncGroup] = "Products" Then
RowDesig2 = "5: INDIRECT PRODUCT EXPENSE"

ElseIf [FuncGroup] "Operations" And [FuncGroup] "Products" Then
RowDesig2 = "7: OTHER SGA-SHARED SERVICES"

ElseIf RowDesig2 = "#Error" Then
RowDesig2 = "9: FUNC GROUP NOT DEFINED"

Else
RowDesig2 = "9: ERROR"

End If

  #2  
Old August 14th, 2006, 08:05 PM posted to microsoft.public.access.queries
jmonty
external usenet poster
 
Posts: 59
Default #Error in custom function

Use a Select...Case statement something like this:

Select Case [FuncGroup]
Case "Operations"
RowDesig2 = "3: DIRECT OPS EXPENSE"
Case "Products"
RowDesig2 = "5: INDIRECT PRODUCT EXPENSE"
Case "#Error"
RowDesig2 = "9: FUNC GROUP NOT DEFINED"
Case Else
RowDesig2 = "9: ERROR"
End Select


jmonty


"Kirk P." wrote:

I've got this function that returns good results except for some records
return #Error. This #Error is expected, and I'm trying to trap it and report
the record as "9: Function Group Not Defined". What am I doing wrong?


If [FuncGroup] = "Operations" Then
RowDesig2 = "3: DIRECT OPS EXPENSE"

ElseIf [FuncGroup] = "Products" Then
RowDesig2 = "5: INDIRECT PRODUCT EXPENSE"

ElseIf [FuncGroup] "Operations" And [FuncGroup] "Products" Then
RowDesig2 = "7: OTHER SGA-SHARED SERVICES"

ElseIf RowDesig2 = "#Error" Then
RowDesig2 = "9: FUNC GROUP NOT DEFINED"

Else
RowDesig2 = "9: ERROR"

End If

 




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


All times are GMT +1. The time now is 10:46 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.