Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error handling converting Macro to a VB Module

Status
Not open for further replies.

Patentinv

Technical User
Aug 26, 2005
84
0
0
US
Hi,
I'm testing my database in runtime mode, I came a cross a macro that gave an error so I converted it to a module heres the code it generated=

Function Find_Applicant()
On Error GoTo Find_Applicant_Err

DoCmd.Echo False, "Please Stand By"
DoCmd.Hourglass True
DoCmd.RunCommand acCmdFilterByForm
DoCmd.RunCommand acCmdClearGrid


Find_Applicant_Exit:
Exit Function

Find_Applicant_Err:
MsgBox Error$
Resume Find_Applicant_Exit

End Function

It still doesn't work I keep getting a little box that shows up saying Resume without error, I click it it comes right back.

Thanks--Any help will be greatly appreciated


 
Ms. A.'s macro capabiloity is largey (150%?) a leftover from earlier versions and remains only as the vestigal remains to permit the use of those (same 'legacy') apps without re-coding. As a general practice, these shoiuld be converted to code (like you already did for this one) when-where eever found. Unfortunatly, the conversion does not necessarily change the call statement to reference the coded version, so you also need to re-visit the code to assure that the code version is instantiated.




MichaelRed


 
Hi,
I appologize about the late response,
Hi lupins46, you mentioned that filter by form is not available in Access Runtime. Is there an alternative way for me to filter to the record I need, which will run in Access Runtime.

Hi MichaelRed, you stated the conversion does not necessarily change the call statement to reference the coded version, so you also need to re-visit the code to assure that the code version is instantiated.
I'm sorry but since I'm not familiar with code this is confusing. Is this the call statement
Function Find_Applicant()?

What is the Code Version?


Thanks--For your help.
 
Yes. the new function is as you stated. What you need to do is look at the code where the macro was called from THROUGHOUT the application and make sure that all instances of hte previous call to the MARCO now reference the FUNCTION.




MichaelRed


 
To develop a 'filter-by-form' equivalent would be a major undertaking.
If you can cut down your filtering to two or three fields you could build a SQL Select statement in code and use that as your recordsource (or build a filter stament on code and apply that).

Or you could use a parameter query which refers to comboboxes on a form and ask the user to pick from the lists.

However you cannot get the full functionality of filter-by-form without a great deal of programming.

 

If I was to pick lets say (client) and (address) as the 2 fields to apply a filter to and lets say the user selected client and entered the clients name or chose it from a list using a parameter query, and clicked it and then clicked a command button called filter with a sql statement or code will it bring back all data in the whole record set in the table that the form is bound to? The PrimaryBid_Master form has about 160-175 fields.

Thanks--lupins46
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top