put query result to cbo control on the form

I have a query as follows:

SELECT TOP 1 qryVisitData.timeIn
FROM qryVisitData
ORDER BY qryVisitData.timeIn DESC;

I want to assign the query result to my cboTO control on my form so when I 
open the form, I already have the default date.  How to do it? Thanks. 


0
Song
4/12/2007 1:22:49 PM
access.queries 6343 articles. 1 followers. Follow

3 Replies
687 Views

Similar Articles

[PageSpeed] 27

Type that SQL statement in the Row Source property of the combobox. Do not 
use quotes to delimit what you input, in design view of the form, the 
property RowSource knows it is a string you are supplying. Also, be sure the 
Row Source Type is set to Table/Query (which is so, by default).

Hoping it may help,
Vanderghast, Access MVP




"Song Su" <csitnnn@hotmail.com> wrote in message 
news:eme0kWQfHHA.3564@TK2MSFTNGP06.phx.gbl...
>I have a query as follows:
>
> SELECT TOP 1 qryVisitData.timeIn
> FROM qryVisitData
> ORDER BY qryVisitData.timeIn DESC;
>
> I want to assign the query result to my cboTO control on my form so when I 
> open the form, I already have the default date.  How to do it? Thanks.
> 


0
Michel
4/12/2007 1:46:47 PM
Why bother using a combo box if you're only going to allow a single choice?

Try an unbound text box with a control source of

=DMax("TimeIn", "qryVisitData")

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Song Su" <csitnnn@hotmail.com> wrote in message 
news:eme0kWQfHHA.3564@TK2MSFTNGP06.phx.gbl...
>I have a query as follows:
>
> SELECT TOP 1 qryVisitData.timeIn
> FROM qryVisitData
> ORDER BY qryVisitData.timeIn DESC;
>
> I want to assign the query result to my cboTO control on my form so when I 
> open the form, I already have the default date.  How to do it? Thanks.
> 


0
Douglas
4/12/2007 1:49:15 PM
Thanks, Doublas. It works great! I use combo box because the drop down 
button will activate a calendar control so user can pick a different date.

"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message 
news:OTUoKkQfHHA.5056@TK2MSFTNGP02.phx.gbl...
> Why bother using a combo box if you're only going to allow a single 
> choice?
>
> Try an unbound text box with a control source of
>
> =DMax("TimeIn", "qryVisitData")
>
> -- 
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no private e-mails, please)
>
>
> "Song Su" <csitnnn@hotmail.com> wrote in message 
> news:eme0kWQfHHA.3564@TK2MSFTNGP06.phx.gbl...
>>I have a query as follows:
>>
>> SELECT TOP 1 qryVisitData.timeIn
>> FROM qryVisitData
>> ORDER BY qryVisitData.timeIn DESC;
>>
>> I want to assign the query result to my cboTO control on my form so when 
>> I open the form, I already have the default date.  How to do it? Thanks.
>>
>
> 


0
Song
4/13/2007 3:50:53 AM
Reply:

Similar Artilces:

PUTTING NUMBERS IN A CELL
I AM TRYING TO ENTER A NUMBER THAT BEGINS WITH ZERO'S AFTER I ENTER IT THE ZERO'S DISAPPEAR, HOW DO I KEEP THEM IN Please turn off the CAPS Lock, more than two lines would be extremely difficult to read. Reading caps is annoying. Format the column as text, if the leading zero is important to you then it is an identification not a number. The default alignment for text is left aligned which is also better for most identification "numbers". Credit card numbers are 16 digits, are identification and can not be entered as numbers, ever, because Excel only retains 15 si...

ActiveX controls and printing
I’m using a form with an ActiveX control (Autodesk’s DWG TrueView) to view AutoCAD drawings. I can print the drawings directly from my database by right clicking on the ActiveX control, then selecting File – Plot. This opens TrueView’s “print dialog” (not sure if that’s the correct term) so that I can select the printer, paper size, and plot area. Is there a way to automate this so I can just click a command button? If someone could point me in the right direction I’d really appreciate it. Thanks. Your control exposes a method, probably named Plot. You can easily see what Methods ...

Dropdown Query
Dear all, I have two columns. Each column contains a defined value and each > value carries some predefined details. I am trying to place a dropdown > through data validation, so that i select any value, i should be getting all > the details related to that value without any extended space. Like below-: > > > A operations > A downtime > a client figure > B ratings > B flow chart > B technical support > > If i select A, I want to get the details of A as dropdown, i select B, i > want to get the details of B. > I have also visi...

Querying Data from Access
I am trying to pull data from Access into Excel. I have successfully done so... well, to a point. Here is my situation: I have a database containing several tables. I only want to pull from two of these tables. One contains inventory data and the other contains descriptions of the data I want to pull. For instance, in the inventory table I have a shirt. The shirt comes in several sizes, however the sizes are contained in a seperate table containing the descriptions and how many of each for the description. The two tables are tied together by unique ID's. What I would like to do ...

Outlook forms #18
I am using a form on Microsoft Outlook for a task. Is there any way to have the Subject field on page 1 (Task) auto-populated by a field that is entered on page 2? Thanks, Frank Yes, with a formula. Drag the Subject field from the Field Chooser to a = custom page, then set the formula on the control's Properties dialog, on = the Value tab.=20 FYI, there is a newsgroup specifically for Outlook forms issues "down = the hall" at microsoft.public.outlook.program_forms or, via web = interface, at = http://www.microsoft.com/office/community/en-us/default.mspx?dg=3Dmicroso= ft.publi...

Parameter Make Table Queries
I have an excel spreadsheet that establishes a link to an Access 2003 DB. I need to be able to run a pre-saved make-table query with 4 parameters that is stored in my DB, and then use excel to run a pre- saved crosstab query off of this table and a few other queries. The results of this crosstab will ultimately be pulled into Excel. I tried changing the make-table into a select and modifying the cross- tab, but because of the parameters and complexity of the cross-tab, it won't work. The first problem is: I "dummed" down my make-table query to eliminate all parameters. Upon ...

Can you put white space outside a textbox?
When I put pictures in my publisher file, sometimes I want captions for the pictures. So I make a tiny textbox that I put under the picture, and type in a caption into that textbox. The problem is that I can make the picture have some space to left and right of it so that text doesn't crowd into the picture, but I can't do that with the textbox containing the caption. Is there any way to prevent outside text from crowding the borders of a textbox? You can move that textbox wherever you need. You don't need to leave space inside when you can steer clear of the textbox itself. ...

How do I change the size of a text form field box in Word?
I f more text is typed in the text form field box then its standard size the other form fill boxes to the right all move over to accommodate the additional text. Is there a way to increase the text form field box? Place your form fields inside (border-less) table cells whose dimensions are fixed. -- Stefan Blom Microsoft Word MVP "Blink" <Blink@discussions.microsoft.com> wrote in message news:383D7E9E-5A0E-4F3A-9586-CAC98B0CD776@microsoft.com... >I f more text is typed in the text form field box then its standard size >the > other form fill...

Query
The query function appears to be very slow. Anybody else experience the same thing. Any solution to this? Can you be more specific? "fajar" <fajar@discussions.microsoft.com> wrote in message news:BD903EC8-6F2B-447E-B80C-DAAEF9F3F533@microsoft.com... > The query function appears to be very slow. Anybody else experience the > same > thing. Any solution to this? ...

Appearance of Controls misbehaving
Hi - I'm having a peculiar problem with controls (there are 3 command buttons) on my Sheet. One of the buttons, called cmdPrint, uses the following code: ActiveSheet.PrintOut Copies:=2, Preview:=True This works exactly as expected. BUT, if I view the Preview, then click 'Close' before printing, there is a problem on the Sheet1. The Print button looks fine, but the other two buttons appear distorted (about five times taller than they were, and slightly wider). what's going on here? How can I prevent this? By the way, if I save and close the file then ...

Is a form open?
Is there a simple way of checking to see of a certain frmName is loaded/open? When I open a required settings form within a main form (when a required setting field is empty), my settings form ends up behind the main form. I'd like to bring the settings form to front & set control focus. Tried this, but doesn't bring the form to front: Private Sub Form_Current() If CurrentProject.AllForms("frmComPort").IsLoaded = True Then Forms!frmComPort!Combo3.SetFocus End If End Sub --- Stewart wrote: > Is there a simple way of checking to see of a certain frmName is > l...

To MVP John Spencer - Report
Hey! Sorry my bad English! My Name Is Per Erik Løkken, and comes from Norway. I have been in contact with MVP Duane Hookom regarding an issue with a report in Access 2007. She tells me that you've had a post regarding the ranking query: “I believe you can do this without the subquery but using a totals query and a self join. MVP John Spencer has posted this type of ranking query in the past. You will get a more efficient and functional result as needed in the report record source.” My report is made with a subquery: SELECT A.VEKT, A.NAVN, A.KLUBB, A.KLASSE, (S...

Automate Export from Form Template to Seperate Table
Hello, I have an Excel Workbook designed as a form entry that I ask clients to complete and email to me. I can then save them on a common network drive if needed. The name of the Workbook is usually changed by the person who completes it and is usually not in a standard format. I'd like to have Excel pull the entered fields from the Workbook into another data table in Excel as a summary table. So I start with client filled forms and want to end with a table where there is a row for each client-completed form. I considered using XML, but my office only uses Office 2000 which see...

Group By Query
Hello. I need a little help. Is there a way to find out which records were grouped in a group by query, and maybe flag that record with a specific tag for example in this scenario: ID Amount Name 1 123 First 2 123 First 3 123 F-irst 4 345 Second 5 345 Second 6 345 Secon-d ....... ....... If I put this table in a group by query and Sum the amounts, I take the LastOfName and LastOfID then I get something like this: ID Amount Name 3 369 F-irst 6 ...

crosstab query question
I am very new to this, but I would like to ask for some help. I have struggled to get the sql code for a crosstab querie (my 1st!), but I just cannot seem to get it right. This example is simpler and shorter than my actual one, but I'll get the right idea from it. I start with a querie like this; VolID LastName FirstName Tool 123 Smith Sue Hammer 124 Jones Molly Drill 123 Smith Sue Screwdriver 126 Nadeem John Sc...

Query. How to add this calculated field?
Add a calculated field for ExitDate, which is when the renter will leave the unit based on the date the rental started + the length of stay * 7 (to convert the total time in unit from weeks into number of days) Hint: StartDate + (Length * 7) ---StartDate, Length are data columns. How can I do this!? I tried: Design View on the Field row typed: [StartDate + (Length * 7)] But it's not working it shows a windows "Enter Parameter Value". Maybe I'm wrong. How can I do this!? *Access 2007 Try this -- [StartDate] + ([Length] * 7) -- Build a little,...

Where to put SQL statements in VC++ Application
I am wondering if putting all my SQL statements in the string table is a good idea. Is there a better place to store these statements?? Thanks in advance for any responses. Dominic Inline in the code, they arnt particually helpful to put in the string table. -- - Mark Randall http://zetech.swehli.com "Those people that think they know everything are a great annoyance to those of us who do" Isaac Asimov <dominicgualtieri@hotmail.com> wrote in message news:1129050897.519688.176820@g49g2000cwa.googlegroups.com... >I am wondering if putting all my SQL statements in...

Web Queries
I'm interested in learning how to customize web Queries. Is the onl way to do this is to use XML? I tried using the Data-> Import Externa Data-> Web Query tool but I'm stuck with the layout thats on the we site. If anybody has any links to any additional literature that would b great as well. I looked in my excel bible but it only shows how t pull the data & not customize it. Thanks -- Phatchef2 ----------------------------------------------------------------------- Phatchef24's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1093 View thi...

results of eseutil /p
eseutil completed ok. However, during it's operation, some error messages were appearing. Are these error messages normal? I ran eseutil using following command: C:\WINNT\system32>eseutil /p <d:\priv.edb_path> /td:\repair.edb /x Example of one of the error: ERROR: error -1603 at line 5006 of G:\ese97 \src\ese\repair.cxx Where does "G:\ese97\src..." is from? There is only c and d partion on the server. Why is there no free on c partition, shouldn't it be using d partition? Just trying to understand how eseutil works. Any help would be appreciated. Th...

Query Optimisation problem. CTE with Ranking function used by12 x union stm
Hi guys, I hope you can help me with this one and get this query to run a bit faster. I have a CTE which looks at data in the table and gives it a ranking number using the rank() over (partition by ?? order by??) syntax. This is done because I then need to run some DQ tests on the data, based on the ranking order of the records. (UK NHS RTT status codes for anyone who is interested...) CTE statement is below. [code] with CTE as ( select R2T.Refrl_refno, rank() over (partition by R2T.Refrl_refno order by R2T.RTTST_Date,R2T. SORCE_Refno) as 'Rank', RV...

Put app and icon in task bar?
I have an MFC application that I want to be able to put in the task bar as a small icon and have it pop up the dialog when selected from the task bar. This app is intended to be run from the start up menu and be minimized in the task bar along with all the other start items... Pointers on how to please... By default app goes on the task bar. Do you mean system tray (that by default appears on the bottom right of the screen)? -- Ajay Kalra [MVP - VC++] ajaykalra@yahoo.com "ShipHead" <GoAway@SpamBoy.com> wrote in message news:#g1K8UgEFHA.2700@TK2MSFTNGP14.phx.gbl... > I...

Anyone Else Use Database Query to Query Another Sheet in the Same Excel Workbook?
Wow! I tried this out, and it seems to work beautifully. It's odd, though, that I haven't seen this technique mentioned in any of the several Excel references that I've looked at. Basically, I have a workbook with several worksheets...one worksheet contains a large list with all the records. I wanted to set up the other worksheets to have certain functions...I wanted them to use only certain columns from the main list, and to contain only certain records from the main list that met specified conditions. This is the best solution I have found so far - i.e., creating database q...

outlook ka-put
After I installed the service pack updates for Microsoft XP, my Outlook has been uable to send or receive any email. I have gotten a few error messages: "unable to connect to network," "server found but did not respond." etc. What the heck do I do? ...

query update
I have a query that is derived from 3 tables with relationships. i want the user to open a form and be able to change data in that query. i'm assuming it is not letting me because it is derived from more than one table. is the only solution to this is to create a table off the query and then base my form on that table. wasnt sure if there was a different way around this. thanks DD wrote: > I have a query that is derived from 3 tables with relationships. i > want the user to open a form and be able to change data in that > query. i'm assuming it is not letting me ...

one query and many forms
Hi all, I have 1 query and 10 forms. The query is used as a look up for a field (StudentID) on all 10 forms. Per request, I added an unbound combo box on all 10 forms (cbo151). I'd like to use the value in this combo box as a parameter for a field in the query. Is there a way I can grab the value in the combo box from the current open form and pass it to the query? I used Forms!myForm1!cbo151 as the parameter but it needs to change for the next form. I'd hate to create 9 more queries. Is there an easier way? Thanks, LGarcia You can use a function to pass the value to the quer...