To Put SQL Result Into A TextBox

Dec 25, 2005

I have a SQL query in a string of a VBA procedure
(e.g. MyQuery = "select sum(Amount) from Investment")

and I want the result to be shown in a TextBox of my form Me.

I know several ways to run the query and to send the result into the TextBox (e.g. with QueryDef and RecordSet). However I guess Access should offer a more direct way to do such a simple operation.

Does anyone has a solution to do it the simplest way ?

Thanks.

View Replies


ADVERTISEMENT

Entering Result Of A Query In A Textbox Using VBA

Jun 14, 2005

I'm pretty sure there's a simple solution to this, yet I can't seem to find it.

I have a table that contains the Months of the year with an MonthID:
1|January
2|Febuary
...

I also have a form that contains a combobox with the Months.

When the user chooses the month, a query gets created, returning the MonthID.

I want to store the MonthID, in an invisible textbox, so that I can use it for my calculations.

If I use a textbox, I can't seem to display the result and if I use a listbox, I can't access that value.

How would I make it work?

This is the code used on the combobox:

Private Sub cbToMonth_Change()
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim strSQL As String

Set db = CurrentDb()
Set qdf = db.QueryDefs("getMonthID")

strSQL = "SELECT Months1.MonthID " & _
"FROM Months1 " & _
"WHERE (((Months1.Month) In ('" & Me.cbToMonth.Value & "')));"

qdf.SQL = strSQL
Me.monthIDTo.Value = "getMonthID"
Set db = Nothing
Set qdf = Nothing
End Sub

View 3 Replies View Related

Forms :: Copy Search Result Into Textbox

Aug 5, 2013

I have a quote form that has a button which opens a simple search form with just one textbox which gives the results in a subform. (the search is for the company name and the subform results give the company name with the full address (company, add1, add2, town, county, postcode)

I would like to have a button on the search form, to copy the correct result into a textbox on the quote.Until now I have just had a cmbox on the quote with the companies and addresses listed. Unfortunately, the users are not checking this list to see if the company already exists and are adding a new company but with slightly different information, so I am getting multi companies. (i.e, smith ltd, smith limited, or Hants, Hampshire etc).

I need a button on the main search form that copies the company name from the search results subform and copies it into a textbox on the quote.I have tried this on a button but it doesn't like it:

Forms![quotes test].[company].Value = Me![COMBINED SEARCH subform].[company name]

View 1 Replies View Related

Efficient Way Of Setting Value Of A Textbox To The Result Of A Select Query

Apr 19, 2005

Anyone know an efficient way of setting the value of a textbox to the result of an sql query?

I am using the following, but it seems to be slow when populating a large form:

Make.RowSource = "SELECT BarcodeDATA.Make FROM (Customers RIGHT JOIN CustomerSales ON Customers.CustomerID = CustomerSales.CustomerID) LEFT JOIN BarcodeDATA ON CustomerSales.ItemNum = BarcodeDATA.ItemNum WHERE (((CustomerSales.ItemNum)=[Forms]![FormCheckConsignmentStatus]![ItemNum])); "

Make.Requery

Make.Value = Make.Column(0, 0)


Let me know if there is a better way to do this.

View 1 Replies View Related

Queries :: Displaying Query Result In Textbox On Form

May 19, 2013

Have a query which looks up an address using the text input into a textbox by the user.

What I'm now struggling with is getting the query result into the textbox.

Am still new to access and am hoping this is something fairly simple.

View 2 Replies View Related

General :: Textbox Displaying Result Of Sum Function In Scientific Notation

Apr 3, 2014

I am maintaining an Access 2003 application that is running on Windows 7 64Bit Enterprise OS setup.

I have a form in the application that displays a number of records with each record having a unique id and a field called ClockHrs which is stored as a Number (Long Integer) type.

I have a textbox that displays the sum of the ClockHrs field.

The textbox contains no code behind.

The Control source property of the textbox is set to '= SUM([ClockHrs])'

ClockHrs
10
10
30
15
10
15
25
===
115

The textbox displays the result of the sum 115 in scientific notation as 1.15 +02 .

View 3 Replies View Related

Forms :: Scan Barcode To Choose Item From Combo Box - Populate Textbox With Result

Jun 14, 2013

I'm working on a project that uses a barcode scanner. The user will scan a barcode which will choose an item from a combo box. The result of what it enters will populate a text box. I have that part working fine.

The next step is to get it to open a form based on the value in the textbox. The textbox will have about 7 different possible values and each one should open a different form.

The way this is supposed to work:

User approaches a machine and scans the barcode. He is presented with a form giving him options based on the type of equipment the machine is. A compressor for example would present him with a set of options for compressors (gauge readings, maintanence, etc).

I have an unbound form with two controls:

cboAssetNumber
txtType

How to code this and which events to code it in. Users will be going from machine to machine and using the form over and over again so I need to somehow manage the clearing of the form to begin again with another barcode scan.

I saw another thread about a barcode scanner and one response was to program the scanner to send the barcode and then send an "Enter" press to move focus to the next control. I've looked through the documentation and haven't been able to find if that is possible. Right now it sends the number and that's it. It's a "Motion" Tablet.

View 14 Replies View Related

General :: Show Query Result In Form Textbox Immediately After Updating A Record

Nov 24, 2014

I am building a Inventory Management Application for Tyre Shop. I have SaleMainTbl and SaleDetailTbl both used for preparing daily sale summary. I have Mainform based on SaleMainTbl with TxnDate and Total Amount (Sale) and the TxnDate is in one to many relation with SaleDetailTbl. FormSaleDetail is multiple row(continuous) form that makes billwise summary of each day having -TxnDate--BillNo--ItemSold--Company--Qunatity--Rate--Amount fields. I have inserted this form in FormSaleMainTbl.

So FormSaleMainTbl is Main form and FormSaleDetail is subform. TxnDate in FormSaleDetailTbl is automatically taken from SaleMainForm. I have further added text boxes in Main Form to show company wise sale for each day for which there is a query build one for each company that takes the currently loaded date from FormSaleDetail and calculates the Sale (Sum) of each brand (Company) of Tyres. All these objects are working very fine. However I have to close the MainForm and reopen it for result of query to appear in the appropriate text box in Main form.

Is there way to do this as soon as record is entered or at least at the end of completing the entry of each days sale transactions without closing the form. So the gist of the problem is realtime display of query result in text box on a form or updating the form screen immediately on updating any record or at the most after completing the updating of form but without having to close the form.

View 5 Replies View Related

Queries :: Conditional Query To Post Result In Field And Filter Result Records?

Mar 5, 2014

I am working with Access 2010, on vista. What I have is a query made up of two tables, one product the other inventory. (see below) query.jpg

In the product table i have a field called "minimum reorder level". In the inventory table i have two fields one called "number in stock" and "number on order". What i want to happen is "number on order" to be filtered by the result, if the "number in stock", is less than "minimum reorder level", if it is, have the result placed in the "number on order" field. EG. if the "number in stock" = 2 and the "minimum reorder level" = 5 then 3 would be placed in the field "number on order" and only the second record from the query would be visible (see below) Query result.jpg The result of this would mean that the field "number on order" would be populated with the result and the and query would also use this to filter the record.

View 1 Replies View Related

General :: Adding Count To Result Of Query Depending On Month And Result

Aug 18, 2013

I want to add a number to my results within a query depending on the month and how many results. For example I have 10 results in my query 3 from January, 5 from March and the rest from April. The 3 from January would be 1,2,3. The five in March would be 1,2,3,4,5 and so on. Is it possible to do?

I'm using access 2003.

View 4 Replies View Related

Queries :: If There Is No Result In Query Need To Have Default Result Zero

Oct 12, 2013

I there is no result in query, I need the default result zero in my form field. I only use query wizard to create queries.

View 5 Replies View Related

Forms :: Update Unbound Textbox In Main Form From Subform Textbox Afterupdate

Apr 17, 2015

How to update unbound textbox on main form from unbound textbox in subform afterupdate.

that is when amount paid is updated it automatically updates total paid, balance etc.

View 2 Replies View Related

Pass Value From Unbound Textbox To Bound Textbox

Oct 26, 2006

Hi: There are two textboxs in my main form. One is bound and another is unbound. There is no entry in the unbound textbox as values come into automatically after entering some information in the subform. My question is how to i pass values from unbound textbox to bound textbox every time when the value change in unbound textbox i need to change the value in the bound textbox. When the form load there is already value in the bound textbox which i want to override based on the values from the unbound textbox.

Thank You.

View 2 Replies View Related

Forms :: Date And ID Number - Textbox Value To Another Textbox

Oct 12, 2014

I have a date textbox (Week_Ending) and number textbox (Staff_ID) in a form (frmHourEnter), when both have values I open another form (frmStaffReport) with textboxes (txtDateStart and cmbStaff).

How do I open the second form with the values of the first form pre-entered?

View 12 Replies View Related

Forms :: Date Form Textbox To Textbox?

Jan 24, 2015

I have a database for billing. In my database, I have a form that consists of a main form "Order" and 2 subforms "OrderDetails" and "Customer" OrderDetails are to enter the products to be connected to the Order. All function super, but I want to have some information from one of the forms "copied" over to on of the others.

Here is what I would like

In the subform "OrderDetails" I have made a textbox that summarize all prices to a total, his tekstbox i called "Tekst31". I would like the amount in this textbox to appear in a field "Bel�b" in the main form "Order".

I have tried some different commands, but nothing has worked, also I have made a query which dose the same ting as the tekstboks, as the information in that tekstbox it not stored anywhere.

View 2 Replies View Related

If The Result Of A - B < 30 Than This Result Will Flash

May 29, 2007

All:
I'd like to make the result of my text box flash (in my form) if the its value is less than 30..For example. If A - B < 30, then the result whatever it is as long as it is less than 30..Is this possible in Access? thanks in advance.. :

View 1 Replies View Related

Copying From 1 Textbox To Another Textbox On Different Forms

Jan 29, 2006

I have a text box on 'Forma' & a textbox (named text3) on 'Formb'.
I want to copy the contents of the textbox from 'Formb' to the textbox on 'Forma'. I have used the following code in the textbox on 'Forma'....

=Forms![Formb]![Text3].text

This doesn't seem to be working whether both Forms are open or only 'Forma'. Could somebody please advise as to what I am missing. Your assistance is very much appreciated.

View 4 Replies View Related

Getting A Textbox To Populate Based On Another Textbox

Mar 18, 2005

Dear All:

I have created a form using access 2000. So far, this form already has data and dates in a combox in this format: mm/dd/yyyy.

In the AfterUpdate of the date combobox, I did this:

If graduation_date = #2/1/2004# then
Text_Graduation_date = "dated this first day of february two thousand four."
End If
End Sub

In addition, I have defined many other dates as well using the code above. It works well when I choose the date form the combobox, the other textbox populates, but there are so many more dates in the combo!

Is there a way to auto-populate the textbox with the appropriate text as I scroll through the form?

Thanks,

Dion

View 5 Replies View Related

Forms :: Bringing Entered Data From One Textbox On Form To Textbox On Another Form

May 17, 2013

I currently have two froms, "add record" and "add record cont." The reason I have two seperate forms is because when clients create a new record information needs to be saved to two different tables and when creating one from with fields from both tables I ran into many problems. The two tables are named : tblMain, tblFileLoc Currently there is a textbox on both forms named "fileID" the FileID in the first form is from tblMain and is the primary key for that table, the FileID on the second form "Add Record Cont." is just a normal field. When clients enter in the new FileID in the first form "Add Record" and then move onto the next form "Add Record Cont." i need access to bring the entered FileID from the first form and Fill it in the FileID field in the second form. Currently I have tried making the control source for the textbox on the second form = the textbox on the first form but it brought up an error.

View 1 Replies View Related

Textbox To Populate Another Textbox

Aug 3, 2005

Dear All:

I have created a form with various textboxes. In one unbound textbox called Graduation_date, I input information and this is reflected in another bound textbox called text762.

However, as I scroll through the form, the information that is to be reflected in textbox 762 disappears.

Any ideas on how to apply the information entered in Graduation_date textbox to all?

Regards,

Dion

View 2 Replies View Related

How To Get Result

Sep 29, 2005

Hello guys,
I Have a table call Hq_Cases in oracle database,I created same table in access 2000,and I created a SELECT QUERy in access ,now when I run this query it shows me empty table,so I want to know how I can bring values from oracle into my access database.
Any suggestion is appreciable.

Thanks
vsap

View 3 Replies View Related

Problem Result

Apr 26, 2006

Hi,
Im getting an odd result returned & I don't know why.

expression:=[lookup]*[yards]+[drop]:=0.296*30+-11.838
Result:=1.20E-27

If I replace value [drop] with -11.838 then the result is correct (-2.958)
ie:lookup]*[yards]+-11.838

The porblem seem to be when [drop] is neg.

View 1 Replies View Related

Result In To Variable

Sep 20, 2005

how can i get the result from a query in to a variable, i want to use this result in a new query?

View 3 Replies View Related

I Want The Name To Appear Only Once In Query Result

Mar 1, 2006

Hi,

I'm designing this system in which each employee has different area of strength (i.e. Math, Languages,..)

if an employee has 2 or 3 area of strength his name appears in the query more than once. I want his name to appear once.

I tried "group by" but it gave me an error. I think I'm doing it wrong.

Please Help!

CS.

View 7 Replies View Related

Strange Result

Apr 30, 2006

I have a select querey

which contains the expresion
forms!frm_itemslct!text8
It should just pick up the value contained within [Text8] which is a number, and it was doing that earlier this evening. I've since changed something and instead of a number it is now showing a small square :confused: For the life of me I can't work out what it is that is causing this.

View 3 Replies View Related

How To Get Result Of Last 5 Days

Sep 7, 2006

Good day :)

I have table with filed "entrydate" which has records of dates from 1 aug 06 to 10 aug 06. How to see the last 5 days result. like form 6 aug 06 to 10 aug 06

Note: I dont want the date to compare with current date date() because this is history data. also I hope to see the result with auto creteria I dont want to add the date in creteria filed manullly.

any assistant is appreciated.

thank you

rosy

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved