Solved

Error when running a macro to run a module

Posted on 2007-04-10
6
837 Views
Last Modified: 2008-02-01
I am trying to test out my module so I have created a macro to run the module.  The macro calls the function partb_gg however when i run the macro i get an error msg: microsoft access cannot find the name partb_gg you entered into the expression.  I have doubled checked the name of the function on the module and it matches with the name that the macro is calling.
0
Comment
Question by:gupshup
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 26

Expert Comment

by:jerryb30
ID: 18885152
Can you post the module code?
Or do the function and module have the same name?
0
 

Author Comment

by:gupshup
ID: 18885205
Below is the module.

Option Compare Database

Function partb_gg()
On Error GoTo Test_Delete_Err_partb

DoCmd.RunSQL "DELETE *  FROM B_Reject_Fact_Monthly where month = [Enter B_Reject Month to Delete:] and year = [Enter B_Reject Year to Delete:]", -1



DoCmd.RunSQL "INSERT INTO B_Reject_Fact_Monthly" & _
" ( prv_id, wk_ending_dt, wk, [month], [year],rej_cd, rej_cd_cnt, reject_total )" & _
" SELECT a.prov_numb, GetWeekEndDate([deny_code]) as WeekEndDate, DatePart('ww',denial_date]) AS wk," & _
" Month([denial_date]) AS [month], Year([denial_date]) AS [year], 'testing' as rej_cd_cnt,'testing' as reject_total" & _
" FROM part_b_rejs AS a WHERE (((Month([WeekEndDate])) = [Enter B_Reject Month to Insert:])" & _
" And ((Year([WeekEndDate])) = [Enter B_Reject Year to Insert:])) Group BY a.prv_id, DatePart('ww',[denial_date])," & _
" Month([denial_date]), Year([denial_date]), GetWeekEndDate([deny_code]), a.rej_cd;"

Test_Delete_partb_Exit:
    Exit Function

Test_Delete_Err_partb:
    MsgBox Error$
    Resume Test_Delete_partb_Exit

End Function
0
 
LVL 26

Accepted Solution

by:
jerryb30 earned 50 total points
ID: 18885228
What happens if you run the function while in design view (F5)?
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:gupshup
ID: 18885248
It asks for a month then a year. when i put in january and 2007 it then says 'datatype mismatch'
0
 

Author Comment

by:gupshup
ID: 18885353
I figured it out.  The macro needs () after the function name.
0
 
LVL 75
ID: 18885656
Yep ....
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question