Pass the results of a query to a variable

I created a query using the Query Builder, the result has one record with two 
columns.  I'd run the query, and pass the value of one column to a variable.  
Any suggests on how this might be done or any suggestion of a better way to 
reach the same goal?
-- 
Tony
0
Utf
3/22/2010 8:06:04 PM
access.modulesdaovba 1670 articles. 0 followers. Follow

1 Replies
959 Views

Similar Articles

[PageSpeed] 5

On Mon, 22 Mar 2010 13:06:04 -0700, Tony A. <TonyA@discussions.microsoft.com>
wrote:

>I created a query using the Query Builder, the result has one record with two 
>columns.  I'd run the query, and pass the value of one column to a variable.  
>Any suggests on how this might be done or any suggestion of a better way to 
>reach the same goal?

variable = DLookUp("fieldname", "queryname")

-- 

             John W. Vinson [MVP]
0
John
3/22/2010 9:22:04 PM
Reply:

Similar Artilces:

Data Validation Query:
Hi Guys, First Post. I need help with the following: I have a row of cells that is custom formatted as H:MM 1) Users enter their overtime in hours and minutes (H:MM) What I am trying to do is have data validation that they can only put their overtime H:MM 2) I try and validate their input by going to DATA | VALIDATION | ALLOW | CUSTOM | and custom = H:MM For some reason this will not work. Does anybody know how to get this working? Any Help would be much appreciated. Rgds, Bw --- Message posted from http://www.ExcelForum.com/ You can choose "Time" from the Allow list...

Count Query
Hi, I'm basing a query on a table,I need ,in one of the fileds of the query to count the filed Q2 if it's >=7 ,grouped by Caller ID and Language.. Here's the SQL i'm using that produces an error: SELECT Csat.Language, Csat.CallerId, Count(Csat.Q2Ans) AS CountOfQ2Ans FROM Csat GROUP BY Csat.Language, Csat.CallerId HAVING (((Count(Csat.Q2Ans))>7)); I don't get an error message,but the numbers counted are not corect if compared to the table from which it got the data,I don't know why.. I want to count How many times a certain Caller ID got more than 7... Than...

Sql Query for Single & parent item Quantity
Hi All I would like to know if there Sql Query to convert the quantities of Parent item to be Single item , i would explain it with an example single item Itemlookupcode is 123456 and Qty 1 Parent item (outer pack of single item) like 6 cans of cola drink forms a pack which can be sold as single as well as pack item Itemlookupcode 123456-06 Qty 2 I need an sql query to produce result like 123456 QTY = 13 and 123456-06 Qty =0. Formula = Qty of Single item + Number of pieces in a single pack * Qty of parent item it would be great help that if it would be possible in sql Thanks ...

Is It Possible To Pass Parameters to A Pass Through Query
My assumption is that's it's not. At work I use ODBC to connect to our oracle database with Access 2003. There are cases where using a pass through query runs much much faster and I then use it in a make table query to make a local table. In access you can use brackets [] to have it ask for input. May I assume there is no way to do anything like that in a pass through query? Create a PassThrough query and use code to assign the SQL to this query filtering it with a parameter, and then run it e.g Dim MyVariable As Integer MyVariable = InputBox("Please select a Number&quo...

Date query 01-21-10
I have a table which contains a field called "DUEDATE", data type is DATE/TIME, formatted as LONGDATE. I use it to enter in dates when projects are due. How can I write a query which returns "DUEDATE" items for the current date. Example: Today is January 21, 2010 and I want to retrieve everything from the table with "DUEDATE" of january 21,2010. If you only store the date part and only want to return records where the DueDate is the current date, set the criteria under DueDate to: =Date() Duane Hookom MS Access MVP "Iago" <Iago@d...

Report Parameter not displaying correct results
Hey there, I have a parameter form that you can choose a Description from or ALL. Its based on this query: SELECT Description, 1 AS SortColumn FROM Study UNION SELECT "All", 0 FROM Study ORDER BY SortColumn, [Description]; When I choose ALL I get no data on my report when there is data. MY RecordSource for the report is: SELECT Study.Description, Study.Product, Study.Dosage FROM Study WHERE ((Study.Description)=forms!SelectTrial!txtDescription) OR((forms!SelectTrial!txtDescription)="ALL") If I choose ALL shouldn't all my Descriptions show up on the ...

Pass multiple selected values from list box to table
How do I pass multiple selected values from a list box to a table? I've found code to use the values as criteria in a query but would now like to store the values in a table (at least temporarily) thanks in advance. jack Pass selected values from a list box to a table? I don't really think you want to do this. Can you describe more about what you are trying to accomplish? You just store raw data in a table. You don't store manipulated data in a table. Maybe you need a query to do what you want to do... -- Ryan--- If this information was helpful, please indi...

Date query "Excel VBA"
Is there anyway i can use vba code to create a user input box on a sale worksheet that will filter the sales orders and only display the order that equal the date entered into the input box by the end user. I am already using the autofilter feature but would like to take it on step further and make it easier for the admin clerk. Thank-Yo -- Message posted from http://www.ExcelForum.com You didn't like yesterday's suggestion???? http://groups.google.com/groups?threadm=4110273A.B3C20CDD%40msn.com "avilla <" wrote: > > Is there anyway i can use vba code to cr...

SUM 2 fields and show the result in another
Hi; I need sum 2 field values(textboxes) and show the resul in another field. I´m programming this, but not work.. OnChange { var value1 = crmForm.all.estimatedvalue.DataValue; var value2 = crmForm.all.CFCMonto_de_Venta_Servicio.DataValue; var result = value1 + value2; crmForm.all.actualvalue.Datavalue= result; } What is wrong?, How is? Miguel Have you forgotten to use the complete custom field schema names including prefix eg:- crmForm.all.actualvalue.Datavalue should actually be crmForm.all.new_actualvalue.Datavalue (if new_ is your custom attribute prefix) Peter "...

Form to query
Hello everybody, I have a question concerning the "Enter Parameter Value" window that opens when I run a query. I have asked this in the access.queries newsgroup but I couldn't get the answer. Is it possible to have that as a combobox so that a list of possibilities is shown? Another question has to do with the same query. This asks a date from and to (in the query criteria >[from] And [to]. I would like the selected period to be shown in the report. Is this possible (and if so... how can I achieve that)? Thanks for all the help you can give -- Lisa Save the Dogs Onlus...

Web Query Help...
If I try and use a web query with the following site http://www.sportsline.com/mlb/stats/playersort/regularseason/yearly/MLB/P I get a message that says the web query returned no data. I click on the arrow right by player and it highlights all the players names and their stats. Anyone know why it doesn't import the data into excel? Is there too much data? Thanks Works fine for me, although one have to do some editing since it imports some trash as well (I would import it, then select the table itself from the import and copy and paste into a new sheet, then import the next 50 and...

Query #2
Is there any query for I can check on item options ACCEPT FOOD STAMP FOR THIS ITEM I need to ad this option on all the SODA & GROCERY department. -- Thank You Harjit Singh SherGill /DBA Altaville Market 324 South Main st po box 370 Altaville CA 95221 Tel : 209-736-1677 Fax; 209-498-3660 Altavillemarket1@att.net Hi Gill Backup the database first and if you can, run these after hours. First jot down the department ID values by connecting to your db and running SELECT * FROM DEPARTMENT -- jot down the ID values for soda and groceries Then check the items you are about to upda...

query to overcome field type problem?
I have a contacts table... let's say 2 fields- ID and email. I have a groups table... it has a number of fields that are linked back to the contacts field already (contact 1 thru nn), so that the groups table just has a contact id number and I look up their email from the other table. One field is also the "primary contact" (similarly linked)... for the person who "owns" that group. Works nicely so far, (thanks, techrat!). Until I try to send email to that primary contact to have them verify the details.... Their email id doesn't show up in the wiz...

How to pass an object from C++
Hello! We have a C# asp.net web application that is using a COM dll We use the tlbimp to be able to use the COM dll from C# asp.net web application The method InitRules shown below is located in the COM dll. It can be seen below the text Original. Method InitRules below is called from C# but we want to pass an object of type Handle_DS in addition to all the other parameters. You can see the modified InitRules below marked Modified Note the object of type Handle_DS is a C++ object that is created from C# asp.net application and pass into the InitRules I have also copied the whole idl fil...

100% Passing Guaranteed in All I.T. Exams/Certifications at 1st Attempt Hi Friends, To pass all types of I.T Exams/Certifications with mind blowing results in 1st attempt just visit http://www.itreal
100% Passing Guaranteed in All I.T. Exams/Certifications at 1st Attempt Hi Friends, To pass all types of I.T Exams/Certifications with mind blowing results in 1st attempt just visit http://www.itrealexams.com/ and get real time Q&As, Brain Dumps, Real Exams, Study material, E-Books, Video Exams and Labs for your all type of I.T Certification Exams. ...

date diff expression in query
I am trying to calculate the difference between two dates 'End Date' and 'Date of Visit' using a query. This is the expression I used: TimeFrame:[Date of Visit] - [End Date]. However, 'End Date' is present in both tables I have used to create this query 'tbl_NewInfo' and 'tbl_Foloowup'. I want the 'End Date' from 'tbl_NewInfo'. How do i specify this in the expression and thereby prevent the error msg I am getting? Thankyou You must fully qualify the field name like: [Table Name].[Field Name] I use a naming convention that resu...

Replace data with the result of a formula
Hello, I have a long list of names in <first> <last> format and want to change them to <last>, <first> format. I know how to do this with a fomula, but want the column with the result to have the actual text, not the formula that produces the text. The only way I've figured out is to export the result of the formula to a text file and then read it in again to replace the original column of text. Is there a better way? Place your formula in a blank column B (insert if needed). Copy Column B and in Column A use Paste Special>Values. Then Delete Column ...

IT CertificationzzzZ.....100% GUARANTEED PASS.......!!!@!!!
IT CertificationzzzZ.....100% GUARANTEED PASS.......!!!@!!! Hi guys, If you are serious about your professional career and pass IT Certification exam in first attempt then Visit http://www.FreeExamKing.com and get latest Questions And Answers Dumps for Microsoft, Oracle, Cisco, CompTIA and many more, i have used and found it very helpful. ...

query problem 05-09-07
Hi, I have two tables. One for employees Info, the other one for employees completed tasks. In employee’s info table, employee ID is primary key while in employee completed tasks table the employee ID is foreign key. Moreover, in the employee completed tasks table there are more than one tasks for one employee. I made a query for showing all employee‘s info and task. The problem is when I run the query, only those who have a record in the employee tasks table just show, while who do not have record do not appear. I need to sum the completed tasks even if there is no data. Any help pleas...

Help Query.
Hi, I have 2 tables, one it has customers who are past due and another table that has customers who have paid and not past due after a certain period. My objective is to find the customers who hasn't paid yet. I did a query, joined by account #, this query will return customers who has paid after they were past due. But I am looking for account IDs of customers who are still past due. Anyway to do this? Thansk for the help! Try the query wizard about finding unmatched rows. It seems you need rows from the first table that are NOT in the second table. Hoping it may help, Vander...

Update query help
Thanks to Jon I have almost solved my problem. When I run the following cade a box pops up that says"yourtable.Datefield" to which I have to enter a date. I would like the code to run autonatically when the database is opened based on the current system time.I would also like to change waiting to pending UPDATE yourtable SET yourtable.Status = "Cleared" WHERE (((yourtable.datefield)<Date()-10) AND ((yourtable.Status)="Waiting")); This should run and update the status of any records that have a date over 10 days old and a status of waiting. TIA yourtable....

Using a VLookup "type" reference but the result is the CELL not th
I'm using a VLOOKUP to help me select a date range from another work sheet. ie 6/01/04 VLOOKs up a date on another sheet and it's corresponding revenue number. The same is applied to 6/30/04. I'm trying to sum the revenue in the cells (days 6/01-6/30) via the VLOOKUP formula, but the VLOOKUP only returns the value and not the cell location. I need the cell locations to sum the revenue numbers in between. ie. the revenue numbers between B4 and B10. Any help would be greatly appreciated Hi try the following =SUMPRODUCT(--(A1:A100>=DATE(2004,6,1)),--(A1:A100<=DATE(2004,6,1)...

Passing data between forms
Hi I am working on a project someone else started, and he has this code: If STR_FormName = "FMS_ToDo" Then Page47.SetFocus He obviously expects the name of the last form to be here, but it is not. In fact, when I put Option Explicit at the top - this field was undefined. How is this supposed to work? Stapes ...

iif, len, replace queries
Hi, I am somewhat of a beginner in regards to my Access skillset. I am trying to create two separate queries and am in need of assistance. I have been trying to use iif, len and replace but am struggling. 1. Text Field (numeric and alphanumeric): If the length of the string is not equal to 10 characters I need to set that value to "9999999999". 2. Text Field (numeric and alphanumeric): I need to remove all "-" and all spaces. From this result I need to display the first 10 characters. If there are less then 10 characters then no value is to be displayed. Thank you...

Passing arguments to procedures
There is something fundamental that I have failed to grasp about passing arguments to procedures. I have a form featuring a set of unbound controls displaying dates and the corresponding days of the week. (For some reason, the long-date format, on my computer, does not include the latter, as the documentation suggests it might, so it has to be separately calculated and displayed.) A default date is displayed in each control, on Form_Open. This can then be manually adjusted by a pair of ‘up’ and ‘down’ buttons associated with each day/date control pair. In the case of the control ‘St...