473,624 Members | 2,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Assigning value to textbox from query?

Hi everyone,

I have a form with a combo box on it. When you select a value (a PO#) from
the combo box, the bound field is the indexID of the selected PO. On the
same form, I have a text box that I'd like to feed from a query I've built.
The query does some math and comes up with a number (qty allocated) for the
selected PO. There are two tricky parts here. That query I've built needs
to filter on the indexID that gets selected from the combo box on the form.
Next, on the text box in the form, I've assigned the control source to be
the query's value. Since there is only one field in the result of the
query, there isn't much to choose from. When I launch the form, I get
#Name? in the text box. Very annoying since I don't know where else to
look. Here are the 3 components:

Combo box on the form (cmboOEPOList):
Bound Column is 1 (the IndexID)
SELECT tOrders.IndexID , tOrders.PONum, tOrders.OurItem Num1, tOrders.POQty1,
tOrders.OurItem Num2, tOrders.POQty2, tOrders.OurItem Num3, tOrders.POQty3,
tOrders.OurItem Num4, tOrders.POQty4, tRefVendors.Ven dor FROM tRefVendors
INNER JOIN tOrders ON tRefVendors.Ven dorID=tOrders.V endorID WHERE
((([tOrders.PONum]) Like "*oe*")) ORDER BY tOrders.PONum;

Query to get my qty allocated:
SELECT Sum(tPartsSent. Item1Allocated) AS TotalAllocated
FROM tOrders INNER JOIN tPartsSent ON tOrders.IndexID = tPartsSent.Inde xID
GROUP BY tOrders.IndexID , tOrders.IndexID , tOrders.POQty1
HAVING (((tOrders.Inde xID)=[Forms]![FormPartsSent]![cmboOEPOList]));

txt65
txtBox on Form where I'm trying to display the value of the qtyallocated
from the query where it filters on the indexID of the combo box
Control Source: =qItem1TotalAll ocated!TotalAll ocated

Does anyone know why in the world this isn't connecting and instead, I get
#Name? in the textbox txt65? I'd really apreciate any help I can get here.
This newsgroup is typically awesome in terms of getting me out of these
tricky binds. Thanks!

Apr 21 '06 #1
2 41279
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The form is giving the #Name? error 'cuz it is looking for the column
named "qItem1TotalAll ocated!TotalAll ocated" in the form's RecordSource.
Unfortunately, we can't refer to the column in a query like that from a
TextBox. The easiest thing to do is use the DLookup() function:

Control Source: =DLookup("Total Allocated","qIt em1TotalAllocat ed")

You'll have to Requery the Text Box whenever you change the ComboBox's
PO# so it will always have the correct value.. E.g.:

Private Sub cmboOEPOList_Af terUpdate()
Me!txt65.Requer y
End Sub

You might want to rename txt65 to something more descriptive. When you
come back to fix/change this form in about a year will you remember what
txt65 is?
--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBREhePoechKq OuFEgEQJfkQCg+d FxEufTdnAX3C8F3 mXpUhimoJMAoLME
32aQVWW2DOiCZVk qLpga9NAh
=Znzs
-----END PGP SIGNATURE-----
MX1 wrote:
Hi everyone,

I have a form with a combo box on it. When you select a value (a PO#) from
the combo box, the bound field is the indexID of the selected PO. On the
same form, I have a text box that I'd like to feed from a query I've built.
The query does some math and comes up with a number (qty allocated) for the
selected PO. There are two tricky parts here. That query I've built needs
to filter on the indexID that gets selected from the combo box on the form.
Next, on the text box in the form, I've assigned the control source to be
the query's value. Since there is only one field in the result of the
query, there isn't much to choose from. When I launch the form, I get
#Name? in the text box. Very annoying since I don't know where else to
look. Here are the 3 components:

Combo box on the form (cmboOEPOList):
Bound Column is 1 (the IndexID)
SELECT tOrders.IndexID , tOrders.PONum, tOrders.OurItem Num1, tOrders.POQty1,
tOrders.OurItem Num2, tOrders.POQty2, tOrders.OurItem Num3, tOrders.POQty3,
tOrders.OurItem Num4, tOrders.POQty4, tRefVendors.Ven dor FROM tRefVendors
INNER JOIN tOrders ON tRefVendors.Ven dorID=tOrders.V endorID WHERE
((([tOrders.PONum]) Like "*oe*")) ORDER BY tOrders.PONum;

Query to get my qty allocated:
SELECT Sum(tPartsSent. Item1Allocated) AS TotalAllocated
FROM tOrders INNER JOIN tPartsSent ON tOrders.IndexID = tPartsSent.Inde xID
GROUP BY tOrders.IndexID , tOrders.IndexID , tOrders.POQty1
HAVING (((tOrders.Inde xID)=[Forms]![FormPartsSent]![cmboOEPOList]));

txt65
txtBox on Form where I'm trying to display the value of the qtyallocated
from the query where it filters on the indexID of the combo box
Control Source: =qItem1TotalAll ocated!TotalAll ocated

Does anyone know why in the world this isn't connecting and instead, I get
#Name? in the textbox txt65? I'd really apreciate any help I can get here.
This newsgroup is typically awesome in terms of getting me out of these
tricky binds. Thanks!

Apr 21 '06 #2
I don't know you, but I know you solved my problem!!!!!

Many, Many Thanks to You! I actually stayed up late to see if anyone would
respond. Thanks again!

"MGFoster" <me@privacy.com > wrote in message
news:%6******** *********@newsr ead3.news.pas.e arthlink.net...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The form is giving the #Name? error 'cuz it is looking for the column
named "qItem1TotalAll ocated!TotalAll ocated" in the form's RecordSource.
Unfortunately, we can't refer to the column in a query like that from a
TextBox. The easiest thing to do is use the DLookup() function:

Control Source: =DLookup("Total Allocated","qIt em1TotalAllocat ed")

You'll have to Requery the Text Box whenever you change the ComboBox's
PO# so it will always have the correct value.. E.g.:

Private Sub cmboOEPOList_Af terUpdate()
Me!txt65.Requer y
End Sub

You might want to rename txt65 to something more descriptive. When you
come back to fix/change this form in about a year will you remember what
txt65 is?
--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBREhePoechKq OuFEgEQJfkQCg+d FxEufTdnAX3C8F3 mXpUhimoJMAoLME
32aQVWW2DOiCZVk qLpga9NAh
=Znzs
-----END PGP SIGNATURE-----
MX1 wrote:
Hi everyone,

I have a form with a combo box on it. When you select a value (a PO#)
from
the combo box, the bound field is the indexID of the selected PO. On the
same form, I have a text box that I'd like to feed from a query I've
built.
The query does some math and comes up with a number (qty allocated) for
the
selected PO. There are two tricky parts here. That query I've built
needs
to filter on the indexID that gets selected from the combo box on the
form.
Next, on the text box in the form, I've assigned the control source to be
the query's value. Since there is only one field in the result of the
query, there isn't much to choose from. When I launch the form, I get
#Name? in the text box. Very annoying since I don't know where else to
look. Here are the 3 components:

Combo box on the form (cmboOEPOList):
Bound Column is 1 (the IndexID)
SELECT tOrders.IndexID , tOrders.PONum, tOrders.OurItem Num1,
tOrders.POQty1,
tOrders.OurItem Num2, tOrders.POQty2, tOrders.OurItem Num3, tOrders.POQty3,
tOrders.OurItem Num4, tOrders.POQty4, tRefVendors.Ven dor FROM tRefVendors
INNER JOIN tOrders ON tRefVendors.Ven dorID=tOrders.V endorID WHERE
((([tOrders.PONum]) Like "*oe*")) ORDER BY tOrders.PONum;

Query to get my qty allocated:
SELECT Sum(tPartsSent. Item1Allocated) AS TotalAllocated
FROM tOrders INNER JOIN tPartsSent ON tOrders.IndexID =
tPartsSent.Inde xID
GROUP BY tOrders.IndexID , tOrders.IndexID , tOrders.POQty1
HAVING (((tOrders.Inde xID)=[Forms]![FormPartsSent]![cmboOEPOList]));

txt65
txtBox on Form where I'm trying to display the value of the qtyallocated
from the query where it filters on the indexID of the combo box
Control Source: =qItem1TotalAll ocated!TotalAll ocated

Does anyone know why in the world this isn't connecting and instead, I
get
#Name? in the textbox txt65? I'd really apreciate any help I can get
here.
This newsgroup is typically awesome in terms of getting me out of these
tricky binds. Thanks!

Apr 21 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
273
by: Patrick De Ridder | last post by:
I posted this query before, but am not seeing it listed. If I enter a return in a text entered into a textBox, the rest of the text gets lost after a write textBox.Text and a read textBox.Text. Is there a better solution than blocking Enter? Patrick.
1
1190
by: Steve Caliendo | last post by:
Hi, How do I set a variable to be null? I want to update a set in a database, and in some cases I would like a particular field to remain unchanged, or null. I'm building a query string based on an array, and so I would like to set a(i,5) to be null. Thanks, Steve
3
13717
by: VB Programmer | last post by:
In my ASPX page how do I get the .text value of a textbox that is in the ItemTemplate of a datalist (using HTML)? The textbox contains the quantity for a shopping cart item. The textbox is called "txtQty" and the current HTML is this (I need to replace xxxx with the text value from the textbox): <A href='UpdateCart.aspx?CartId=<%# DataBinder.Eval(Container.DataItem, "CartID") %>&Qty=xxxx'><IMG src="Resources/UpdateBtn.jpg"...
3
1668
by: astro | last post by:
this must be obvious and i'm missing it............... i want to have 4 checkboxes in a groupbox - box1 value = 1, box2 = 2, box3 = 4, box4 = 8 these ctrls are not bound...I want to assign these values.. how do i do this (i.e. what property in the IDE property window do i use)? also - can i get the groupbox value to reflect the sum of the selected
2
5806
by: minu | last post by:
Hello all I am beginner to VB I populate all the professers name in one combobox ,If i select one professer name then thier designation will automatically display in textbox from database field designation rs.Open "SELECT name,designation FROM profile", con cboMenu.Clear Do Until rs.EOF cboMenu.AddItem rs("name") cboMenu.ItemData(cboMenu.NewIndex) = rs("designation")
4
3328
jeffbroodwar
by: jeffbroodwar | last post by:
Hello, i have a problem about assigning a char value to a byte... please check the code below : ======================================================== Scenario # 1 : This code doesn't work : byte buffer = new byte; char tempValue; int StartAddress; buffer = tempValue;
8
6225
by: getmeidea | last post by:
Hi, I am using JDK 1.5. I have a program like this. Here i am directly assigning value to one object. It does'nt give me any compile time or run time error. In java we dont have access to any object reference. Still this kind of assignment is allowed. What is the reason behind this. Class Sample{ public static void main(){ //Assigning value to object reference itself. Integer i = 10;
10
1760
by: arial | last post by:
Hi all, I need some help on retrive the value from query string. I have two web forms. One has the datagridview which displays the data from database. On one of the column I made a hyperlink to go to next page like, qi.aspx?qi_track={0} and now I need to open a detail of this qi_track on second page. how can I extract the value of qitrack from the url.
3
6786
by: JenniferM | last post by:
Annnnnd I'm back again, with a new problem, of course. I've got a table, TblKneeExamInfo, which corresponds to a form, FrmKneeExamInfo. In it, there is a section where I need to input patient answers for questions regarding pain, swelling, etc (These are all numeric values ranging from 0-4). Currently I have a query set up that calculates the overall subscore for a particular group of questions, say for those regarding pain. This is the SQL...
0
8242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8488
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7170
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4183
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1793
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.