473,394 Members | 1,752 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.

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 "projectorganization", 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 1661
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.OpenReport. 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*****@epitome.com.sg> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.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 "projectorganization", 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*****@epitome.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_Click()
On Error GoTo Err_cmdOpenForm_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmEmployeesFull"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_cmdOpenForm_Click:
Exit Sub

Err_cmdOpenForm_Click:
MsgBox Err.Description
Resume Exit_cmdOpenForm_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 = "frmEmployeesFull".

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 frmEmployeesFull,
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
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...
7
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...
7
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...
1
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...
1
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);...
2
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
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...
1
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...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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.