473,779 Members | 2,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Restricting a the values dialogbox list based on the values in a form

I am creating a simple project information database. In the project
information form 1 have two subforms. one contains organization
involved - many organzation can be involved - and another list of
people; they are from the organization choosen, To help me select the
people, I created a query to the "projectorganiz ation", this narrowed
down the list to pple who belongs to the organization which are
involved in one project or the other. so in this query, I have the
projectID, the organizationID and the people's id.

The problem I have not is that the dialogbox I created based on this
query does not limit the return to based on the projectID alone but in
fact the whole query. How do I "restrict" the dialogbox list?

Thanks for any suggestion.

Mar 25 '06 #1
4 1685
Use criteria with the Query. If you are opening a Form or report, you can
supply that information through the Filter, or the WhereCondition argument
of the DoCmd.OpenForm or DoCmd.OpenRepor t. If you are just running a Query
which displays a datasheet view (I'd recommend against doing it that way,
however) you will have to insert the Criteria in the Query. You can use VBA
code to modify the SQL, or you can have the Criteria refer to a Control on
an open Form.

Larry Linson
Microsoft Access MVP

"Fendi Baba" <ef*****@epitom e.com.sg> wrote in message
news:11******** **************@ e56g2000cwe.goo glegroups.com.. .
I am creating a simple project information database. In the project
information form 1 have two subforms. one contains organization
involved - many organzation can be involved - and another list of
people; they are from the organization choosen, To help me select the
people, I created a query to the "projectorganiz ation", this narrowed
down the list to pple who belongs to the organization which are
involved in one project or the other. so in this query, I have the
projectID, the organizationID and the people's id.

The problem I have not is that the dialogbox I created based on this
query does not limit the return to based on the projectID alone but in
fact the whole query. How do I "restrict" the dialogbox list?

Thanks for any suggestion.

Mar 26 '06 #2
Larry, my apologies, how do I insert the Do.Cmd criteria on the
openform command?

Mar 26 '06 #3
"Fendi Baba" <ef*****@epitom e.com.sg> wrote
Larry, my apologies, how do I insert the Do.Cmd
criteria on the openform command?


Best I can do is an example:

The Command Button Wizard will create code for you, in the Command Button's
Click Event that contains the DoCmd.OpenForm. .. it will look something like
this

Private Sub cmdOpenForm_Cli ck()
On Error GoTo Err_cmdOpenForm _Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmEmployeesFu ll"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpenFor m_Click:
Exit Sub

Err_cmdOpenForm _Click:
MsgBox Err.Description
Resume Exit_cmdOpenFor m_Click

End Sub

You add VBA code to create a "WHERE Condition without a WHERE" between the
line
Dim stLinkCriteria As String
and the line
stDocName = "frmEmployeesFu ll".

If, for example, you have a ComboBox on the same Form as the Command Button
that opens the form, and its name is cboEmployee, with its Bound Column
being EmployeeID, and that is the column used as the unique record ID in the
Employees Table or Query that is RecordSource for the Form frmEmployeesFul l,
then you would add

stLinkCriteria = "[EmployeeID] = " & Me!cboEmployee

That's just about as detailed as I can get without trying to give a complete
course in VBA and the Access Object Model, which cannot be done in a
newsgroup response.

Larry Linson
Microsoft Access MVP

Mar 27 '06 #4
Thank you very much. You have given more than I expected.

Mar 27 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2712
by: Xenophobe | last post by:
I have a popup window (required by the client) containing a form and would like to prevent users from accessing it directly. They are instead required to access the page via a hyperlink on another page. HTTP_REFERER, while not completely reliable, would serve the purpose except for another problem. The hyperlink points to a JavaScript function which opens the popup. This yields HTTP_REFERER worthless. My other thought was to create a...
7
2379
by: Adam Hartshorne | last post by:
As a result of a graphics based algorihtms, I have a list of indices to a set of nodes. I want to efficiently identify any node indices that are stored multiple times in the array and the location of them in the array /list. Hence the output being some list of lists, containing groups of indices of the storage array that point to the same node index. This is obviously a trivial problem, but if my storage list is large and the set of...
7
2579
by: Dave Hopper | last post by:
Hi I posted a question recently regarding problems I am having getting a value from a list box to use in a query. I got a lot of help, for which I thank you and it's nearly working! But I need a little more help on one more point. This is what i've got. I have code that hunts for updated appointments in a public folder based on the order that happens to be open (code fires on an on open event) This works fine and updates my
1
1969
by: foreman | last post by:
Hello Everybody: I am trying out DialogBox, and I have been trying to press the OK Button on the dialogbox hoping I can receive the OK DialogResult to Main Form. Below is my OK button click event handler code on AboutBox Dialogbox: DialogResult = DialogResult::OK; It can also dismiss the dialogbox and return OK "Ideally".
1
2375
by: Tim_k | last post by:
Hi, I'm using showModalDialog to open a Window and return a user selected variable. Here is the code: retval=window.showModalDialog(sFrameName,window,sFeatures); document.getElementById(sControlName).value=retval; This works fine but I can't figure out to pass a value into the dialogbox I'm creating. I display different data in the dialogbox based on this variable. Anyone have a suggestion?
2
14748
by: Zlatko Matić | last post by:
Hello. How to reference selected values from a multi-select list box, as a criteria in a query ? Is it possible at all? Regards, Zlatko
4
2905
by: virtualgreek | last post by:
Dear All, First of all I would like to take the time to thank you all for your efforts and time spent at this wonderful forum. I have found it very helpful with numerous examples available for every level of user. I am facing a rather weird behaviour with a combo box on a subform (Continuous form). I have two tables. Order and Order_Details. The master form is based on the Orders tables and the details form (subform) is based on the...
1
8063
by: The.Daryl.Lu | last post by:
Hi, two parts to my problem if someone can help address either one or both: 1. I want to SELECT everything in the table if it matches the criteria when the query button is pressed (this is just a commandbutton on my form). The biggest problem I'm having is that I can't (don't know how) populate a combobox on static items such as "True, False, Any." The Any field, would be selected by the user to find all records where that fields is...
3
2406
by: Thelma Roslyn Lubkin | last post by:
I have a form whose rowsource is a single table, i.e. 'Datasystem'. I use a combobox to search for records in that table based on the value of a single field, i.e., 'systemname'. I use a multi-select listbox to filter the form on a different field, i.e. 'domain', so that the filtered form can have several allowed values of this field
0
9474
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9931
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5504
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.