?
Solved

Error when running a macro to run a module

Posted on 2007-04-10
6
Medium Priority
?
838 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 200 total points
ID: 18885228
What happens if you run the function while in design view (F5)?
0
Technology Partners: 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!

 

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…
Suggested Courses

801 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