Modules & VBA :: How To Make A Text Box To Show Results Of A Query To Display On Screen
Dec 4, 2014
We have a button running a SQL query via VBA, how can I make it so the results doesn't show up in a table/preview?Also, I know it's for the SQL forum but how can I make a text box to show the results of a query to display it on screen?
See my 2 attachments. I put the Pop-Up property on the form. that worked but still not what I want.
On the HATT attachment do you see how it opens in the middle of the screen? And the other opens at the top right, (and has that tab at the top right that says frmMain)?
how do i made the airwatch open in the middle? like the other screenshot?
Hi, I have created a form (Form1) based on a table (Table1) and also a Query based on this table (Query1). I calculate a field in the query (Expr1: [column1] + [column2]) Now i have created a text box on Form1 that should display Expr1. I know I could also calculate the value directly via the expression builder, but I would prefer to simply display Expr1 from my query. Which is the syntax I have to use in the Expression Builder? I tried "= [Query1]![Expr1]" but it does not work. Thanks for your help Tigrou
I basically want to Loop through a query (or if not possible trough a table) and show the results in my form. For each record in the table I am doing additional checks when loading the form and showing that result accordingly. I do not want to do these checks in additional queries - I think it is more efficient doing it in the form directly. Here is the code I have:
Dim dbsSR As DAO.Database Dim rstValQry As DAO.Recordset Set dbsSR = CurrentDb Set rstValQry = dbsSR.OpenRecordset("qry_val_tbl_ind_rec-rev_import") With rstValQry While (Not .EOF)
[Code] ....
The Loop seems to work because in debug it is going through it 3 times (the number of records I have in the query), but the result is always the same - it seems the above code is not checking / refreshing based on the individual query records.
Am working with Access 2007. I have built a macro that opens several make table queries and exports the tables to excel spreadsheets. Macro functions properly, however the query results still show in the access database screen. What macro command can I use to close these screens after the action is done? I use the CLOSE command for each query but the results still show in the Access window.
I am using MS Access 2007 and have a report which display the list of values (say 10 fields) from the basic SELECT * FROM table query.
I need to dynamically set the BOLD based on the particular value for the fifth field which was assigned from Query. if it doesn't match it should display normal.
E.g If Field_5 = "Agent" then Field_5.FontBold = True Else Field_5.FontBold = False End if
I tried the aforementioned code and it dont work. ALso i tried achieve it using below listed options.
I have a parameter query built and am curious if anyone knows of a good way to allow the user to define which fields are displayed in the query results.
i tried looking for other threads discussing this without any luck.. not sure if it was my search terms or what. thanks so much for any help..
I have query that creates table with 2 records each with 2 columns (2x2) and they do not have indexed ID,and query is related to combo box in other form so results are not always same but it is always (2x2) and value types are always same,
So how to show those results in text box in form,lets say 4 text boxes ,every value in one text box, i assume that i need to use DLookup() but i was able only to show first record,did not know what criteria put to go to second record.
When i select that query and create report i get what i want but i cant copy those text boxes to form that i want.
The user will select two dates. Start and End date. The user will hit the run button and the application will read an excel file with employee data and only display/output the records within that date range selected (employment date).
Code:
Option Compare Database Function DeleteTable() 'Delete old records from AllEmployeesData table On Error GoTo DeleteTable_Err
[code]....
I am not getting the query displayed on the datasheet after it is done executing. It's just a blank sheet. Also the output file is just this:
Code: ssn last mi first employ
I did a quick query test using SQL in Access and it worked fine there. I am guessing my error is somwhere in this section:
Code: '--Display query result on Datasheet and Output query to text file With db Set qdf = .CreateQueryDef("NewHireQuery", strSQL) DoCmd.OpenQuery "NewHireQuery" .QueryDefs.Delete "NewHireQuery" End With db.Close qdf.Close Set qdf = Nothing
I have one table (500 Club) with two fields (ID) (Name) i would like to randomly pick a record from the table and display the results in two seperate text boxes on a form one for (ID) and one for (Name). I intend to use this for a monthly draw at my workplace.
A search form, to search into those tables (It searches by "User")
The search form contains a listbox that shows results (listPC)
And the following code:
Option Compare Database Dim strUserPC As String, strUserTel As String Dim db As DAO.Database, rsUserPC As DAO.Recordset ', rsUserTel As DAO.Recordset Private Sub txtSearch_LostFocus() strUserPC = "" strUserTel = ""
[Code] .....
It works, but I have one problem. It only shows telephones or desktop, not both. It deppends on which line inside UpdateList is first.
That example searches into 2 tables:
-Telephones -Desktops
And searches by "user".
I want to list all telephones and desktops that a user has assigned.
How to display only the first few records in a subreport but keep the grand total of the report itself. When I limit results in query; it gives me the records but only totals for that set. I thought about putting code in the on format in detail section like:
Code: If me.control.value >10 then me.control.visible =false
I have a query that prompts the user for input to generate a report. I would like to in essence copy that same record set and append it to a different table (archive table).
When I query my database I want to return groups of records. The groups differ from one another based on one field (Employee ID) -- So one group with Employee ID# 1 may have 2 records and another group with Employee ID# 2 may have 5 records, etc. My question is: What is the best way to display these groupings and allow the user to scroll or navigate thru the different groups easily? Any help is appreciated.
I have this splash screen, which welcomes all the users. It has an OK command button that exits the screen, and a checkbox that says "Do not show this screen again". I still do not have the code behind the checkbox. Thus I was wondering if there is a way where I could entirelly close or "get rid" of the splash screen until the user loggs in again. Because right now there is no code behind it, so everybody that checks it and click OK, leaves the screen. But they can still open it, if they select the "splash form".
I have been doing a lot of searching on the forums, and I can't seem to find an answer to my problem.
I have a form that uses a query to create an e-mail. This e-mail lists all of the different tests to perform on a sample of a product. My table set up is as follows:
tblProducts ProductID ProductName
tblTests TestID TestName
tblSamples SampleID ProductID TestID
The purpose of this is to send out a sample of a specified product and perform 1 to XX tests on it.
If there's a post out there that addresses this, please point me in that direction as I've had no luck.
I have my queries listed in a table. On my form I have them listed in my combo box. The user selects the query they want and hits the command button "Run". I would like to show the selected query in a subform on the main form and then give the user the option of selecting another command button to export the query to Excel.
I thought it would be as simple as setting the recordsource of the subform to the query name in my combo box, but that doesn't work.
Current code to run query in separate window:
Command button "Run" Private Sub Command9_Click() DoCmd.OpenQuery Me.Combo2.Column(1)
Attempt at getting what I want:
Privat Sub_Command9_Click() Forms!frmQuerySelection!sfrmQuery.Recordsource = Me.Combo2.Column(1) or perhaps sfrmQuery.Recordsource = Me.Combo2
I have created a query with parameters keyed in from unbound textboxes on a form. Does anyone know of a way to display the results (queried) in the sub-form of the same form (main) the textboxes reside? I have the query set up to create a table but when I use that table (or the query itself) in the subform I get the error message:
"The database engine could not lock table "tablename" because it is already in use by another person or process."
This seems appropriate because I am querying for results, but is there any way to get the results of a query into a form, rather than the more common pop up datasheet? I have tried several macros to open and close the tables - queries - copied tables ..re-opened forms....etc, but can't get it to work.
Thanks, for any help, I have spent some time on this one!!!
I have a form that I am trying to show in a text box the results of a count query. The query has two fields in which one is a check box. The criteria for the text box field is set to true to list all that are checked. I want the query to show all the records that are true. This works if I run the query, but the result isn't showing in my text box on the form. On the form text box properties in Control source I have =DLookUp("[Run Number]","Control Room Drumctqry"). Run Number is the field that I am counting, Control Room Drumctqry is the query. Any idea as to what I am doing wrong? Thanks,
I have a form that I am trying to show in a text box the results of a count query. The query has two fields in which one is a check box. The criteria for the text box field is set to true to list all that are checked. I want the query to show all the records that are true. This works if I run the query, but the result isn't showing in my text box on the form. On the form text box properties in Control source I have =DLookUp("[Run Number]","Control Room Drumctqry"). Run Number is the field that I am counting, Control Room Drumctqry is the query. Any idea as to what I am doing wrong? Thanks,