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

Setting Query Criteria based on SubForm Selection

Hi all,
Extremely new to Access and VBA, I have been working my way through several books and sites, and I'm finally breaking down and crying for help.

I am developing a contacts/messages/engagement/appointment tracking application for the CPA firm that I work for. I have made a main switchboard containing tabs with commands to open detail for records, but it is also important to be able to quickly view summarized data for outstanding engagements, calls and appointments. To do this I've created subforms on the switchboard displaying the pertinent info, I would like to be able to double click on one field (such as their number) and it display all phone calls from that specific client.

I have written a query and edited the onclick event to do this, but it pops up with a dialog box to enter the clientID, I would like to filter the query automatically based on which client I click on. My question is, how can I reference the specific client clicked on in VBA to define the query's criteria?

Does this seem like a decently efficient way to get what I'm asking for?

Thank you to anyone who can shed some light on this.
Dec 16 '10 #1
2 2427
Delerna
1,134 Expert 1GB
You can reference the contents of any control on an open form from your query in the criteria for the field in design mode of the query editor.

Use
Forms!FormName.ControlName


Hope that helps
Dec 17 '10 #2
Delerna
1,134 Expert 1GB
Just some words of encouragement

There are many ways to do what you require.
Which way is best depends largely on the particulars of what you are doing.
What works in one scenario may not in another.

It is up to you as the developer to make that choice based on your experience, your knowledge and maybe some guidance from sites such as this.

Ultimately, you can only work with what you know. The most important criteria, in my humble opinion, is that it works and that it performs acceptably for your client/users.

That it is not "the most efficient" method matters little in practice providing the above are true.
Sure, you should strive to be as efficient as possible but we must all start somewhere and we all grow as we gain experience.
Dec 17 '10 #3

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

Similar topics

2
by: neptune | last post by:
I have a query where each customer has an or . Sometimes both fields for a customer are populated, but if is null, then will be populated and vice versa. I have a form, , where I select a...
2
by: Tom | last post by:
I have the following tables: TblState StateID State TblCounty CountyID StateID County
1
by: Nerry | last post by:
Hello again, I used the criteria, Between and , to get results for eg. what courses did a lecturer teach for start date 01-09-06 and end date 30-09-06, and it doesn't work, i get a blank result...
25
by: artromanov | last post by:
Hello everyone. I am somewhat new to access and this forum. Hopefully it will be a great and helpful experience. My problem is this. I have a database (about 65,000 records). I get a run from...
7
by: Triple7 | last post by:
Hi there, basically what I am trying to do (without using code as I don’t know how to do that with a code) is to retrieve the previous 5 days & the next 5 days (date wise)against a query1 that...
5
by: jslssuze | last post by:
I have medium experience with Access but need help trying to create a query for the following scenario... any and all help will be greatly appreciated! A user will select different items on an...
2
by: shreyasi | last post by:
i create a page..there i use check box..how can i call perticular quary from mysql using the check box.i want if i select a checkbox and submit the form then the corrosponding record will be...
1
by: pipestew | last post by:
I have a form which allows me to enter a value and then view a report based on that value. The value is currently entered as P-##### and the query criteria is... !! I want the Form to have...
2
by: willyc | last post by:
Hello all, hopefully you will kind enough to offer some assistance.... I want to make what i believe could be quite a complex query, something beyond the 'basic' access queries. I'm not afraid of...
5
by: hbaf208 | last post by:
I have an option group (TimeFrameOption) with three options: All, Last 6 months, and Last 12 Months. When an option is selected, I want to query dates in a listbox (CallReport) to display all dates...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.