Solved

Error when running a macro to run a module

Posted on 2007-04-10
6
834 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
  • 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

786 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