473,405 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Form Name As Sub Parameter

Breezwell
Hello everyone,

This seems like a simple thing to do, however no matter what I try I cannot manage to pass a form name to a function in order to open that form. The name of the form is DisplayUI_CoreSearch_UniqueGroupCode_Count. The function is stored in a module called modUniqueCounts.

I keep getting a ByRef argument type mismatch error.
Procedure
************
Expand|Select|Wrap|Line Numbers
  1. Public Sub UniqueCountFormDisplay(FName As Form)
  2.  
  3.     DoCmd.OpenForm FName, acNormal
  4.  
  5. End Sub
Event That Calls the Function
**********************************
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtUniqueFlavorCount_Selling_Click()
  2.  
  3. Call UniqueCountFormDisplay(DisplayUI_CoreSearch_UniqueGroupCode_Count)
  4.  
  5. End Sub
Thanks for any insight.
Jun 6 '09 #1
4 2088
missinglinq
3,532 Expert 2GB
Change these two lines as indicated:

Expand|Select|Wrap|Line Numbers
  1. Call UniqueCountFormDisplay("DisplayUI_CoreSearch_Unique GroupCode_Count")
Notice the quotes around the form name.

Expand|Select|Wrap|Line Numbers
  1. Public Sub UniqueCountFormDisplay(FName As String)
Linq ;0)>
Jun 6 '09 #2
NeoPa
32,556 Expert Mod 16PB
Linq's solution is the more sensible, but in case you need to know how to pass forms (rather than simply their names) to procedures, here is what you need :
Procedure
Expand|Select|Wrap|Line Numbers
  1. Public Sub UniqueCountFormDisplay(ByRef FName As Form)
  2.  
  3.     DoCmd.OpenForm FName.Name, acNormal
  4.  
  5. End Sub
Event That Calls the Function
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtUniqueFlavorCount_Selling_Click()
  2.  
  3.     Call UniqueCountFormDisplay(Form_DisplayUI_CoreSearch_UniqueGroupCode_Count)
  4.     'Or, if you know the form is open already
  5.     Call UniqueCountFormDisplay(Forms!DisplayUI_CoreSearch_UniqueGroupCode_Count)
  6.  
  7. End Sub
Jun 6 '09 #3
Thanks for the feedback guys.

I utilized passing the form name as a string, however both solutions have taught me something new.

Again, thanks for the great help!
Jun 10 '09 #4
NeoPa
32,556 Expert Mod 16PB
You'r very welcome :)

I think I'd have used Linq's solution in your position too ;)
Jun 10 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Willoughby Bridge | last post by:
Hi - Having trouble getting a multipart series of forms to move to the next form. The problem line is: <form method="post" enctype="multipart/form-data" action="Data_Form1.php"> If the...
10
by: Gregory A Greenman | last post by:
I'm trying to write a program in vb.net to automate filling out a series of forms on a website. There are three forms I need to fill out in sequence. The first one is urlencoded. My program is...
0
by: Frank 'Olorin' Rizzi | last post by:
Hello everyone. This is quite convoluted, but I'll try to make it simple. I have a couple of bottom-line questions (I guess): 1~ what happens between the Page_Load routine in the code behind...
21
by: Just Me | last post by:
I've tried in a few places using a variable name Form and it appears to be OK. For example: Public Shared Sub WritePositionsInRegistry(ByVal Form As Form, ByVal SubkeyName As String) Is it OK...
8
by: Vivek | last post by:
Hi, I wish to update the LIST<T> created in PARENT FORM from the CHILD FORM. Currently I have declared the LIST<Role> as public in my parent form. What can I do to update the <LIST>? Thanks
5
by: hfk0 | last post by:
Hi, I'm new to ASP.net, SQL Server and visual studio.net, and I'm having problem inserting and storing data from a web form to a SQL database. I created a simple ASP.NET web form, a simple SQL...
2
by: fstenoughsnoopy | last post by:
I have a customer order database and I need to pull a customers information, ie first name, last name, address, city, state, zip, phone, etc, into the oder table. i don't know how to go about...
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
8
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query...
6
by: Dave | last post by:
On my form I have combo boxes. These combo boxes, after updating them, populate respective listboxes that are located below the combo boxes on the same form. I am trying to use a "generate...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.