473,394 Members | 1,935 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,394 software developers and data experts.

Opening a Form based on information from another form

Access 2003, Windows XP.

Currently I am able to open a form - case form - based upon information input by the user in another form - search form. I would like to be able to open the case form based on infromation from the search form or a click from another form. I can get the query to execute, however it only works if both conditions are met. Is there a way to get around this?

Expand|Select|Wrap|Line Numbers
  1. SELECT [Case Data].[Case Number]
  2. FROM [Case Data]
  3. GROUP BY [Case Data].[Case Number]
  4. HAVING ((([Case Data].[Case Number])=[forms]![Start]![Search]))
  5. OR
  6. ((([Case Data].[Case Number])=[forms]![Part Information]![Contract]![Case Number]));
  7.  
Any help would be appreciated!

Thanks,
Cady
Oct 23 '08 #1
5 2918
NeoPa
32,556 Expert Mod 16PB
I understand what you're doing. I don't understand what you're trying to do :S

"based on (...) a click from another form"??
Oct 24 '08 #2
Let me see if I can explain this better without being too verbose! There are 2 main forms in the database and there needs to be multiple ways to enter those forms. The forms are Part Information and Case Information. The user can enter either a part number or a case number in the Search form and display either the Part information form or the Case information form. The user should then be able to click on the Case Number located in the Part Form and open the Case Information form or vice versa. So I added the query from my first post. This should open the Case Information form based on either a case number being entered from the search form, or the click on the case number from the Parts Information form. The way I have written it, the query needs both pieces of information before it will execute and then it returns the first number encountered. Long and short of it, Instead of having multiple copies of the same form that use information - as the result of a click, or entering into a search field - to open the proper record, I want one form and multiple ways to pass it that information. I may be approaching this from the entire wrong direction so any direction will be helpful!
Oct 24 '08 #3
Or possibly better stated enter a case number into the search field of the search form, or click on the case number field in a subform in the form Parts Information. Hope this clarifies things.
Oct 24 '08 #4
DonRayner
489 Expert 256MB
Create yourself a public variable in a standard module

Expand|Select|Wrap|Line Numbers
  1. Public MyVar as string
Create a public function in either the same or another standard module

Expand|Select|Wrap|Line Numbers
  1. Public Function MyFunction()
  2. MyFunction = MyVar
  3. End Function
Use this function as the critera for your query then all you have to do is set the Variable wherever you need in your forms
Oct 24 '08 #5
NeoPa
32,556 Expert Mod 16PB
Ah. I think I get you now.

I suggest what you do is design your case form to show all records (remove the HAVING clause from the query it is bound to).

Now you can use a filter (WhereCriteria parameter of the DoCmd.OpenForm line) to specify which record to include.

You can also pass a value to the form itself, essentially allowing the OnOpen code to reset the filter (or RecordSource) on the fly.

The typical way to limit records on a form is to apply a filter like this rather than to design the criteria into the SQL (or query). It's easier in the long run.
Oct 24 '08 #6

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

Similar topics

44
by: Carlos Andr?s | last post by:
Hi everybody. I've got a problem. I'd like to avoid opening a new window when you have pressed the shift key and you click in the left button of the mouse. I've tried the next solution, in the...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
3
by: Jim Evans | last post by:
Using code and suggestions from an earkier thread in this group, I have created the following cond for the open event of a form I am opening from the button click event of another form. ...
1
by: meganrobertson22 | last post by:
hi everybody- what is the best way to add data from one form to another? i have 2 tables: person and contract. here are some of the fields. table: person personid (autonumber and primary...
3
by: Rolan | last post by:
I need assistance regarding code needed to prevent someone from opening a form if a table field name(s) has been changed. For example, there is existing code to check for certain data based on...
1
by: chingchanglang | last post by:
Hi, what I'm trying to do is probably very simple...but simple is relative! :D I have a cmbo box on a form "". It is populated with a query to show me all the Topics in my table where the primary...
1
by: robertmeyer1 | last post by:
Hey, I am having a problem with opening some forms. I have several forms. The forms are based off the same table, tblClient. Each form has a sbf inserted into it. These sbf’s are each based...
3
stonward
by: stonward | last post by:
Hi Guys, I have a main form, based on a query, with a subform based on another, that is used primarily for data input. The whole thing is my QUOTATION form. I want to print (view first) this, and...
2
by: ssmith147 | last post by:
Hi, I'm somewhat familiar with access and vb programming (I can read someone else's code, for the most part), but I'm still very green when it comes to creating solutions for my own needs. I'm...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.