473,698 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bound control bug when two SQL fields have same name

Hi,

I've got two fields in seperate SQL tables (a and b), both called trackNum.
b.trackNum is a foriegn key into a.trackNum. I've got a form with a few
bound controls on it (textboxes specifically), one of which displays the
trackNum from the query "SELECT a.*, b.* FROM a, b WHERE a.trackNum =
b.trackNum". All of the controls are displaying their data correctly except
txtTrackNum, which is always displaying the digit 1. If I change my query so
that it only selects trackNum from a everything is hunky-dory. Anyone come
across this behaviour before?

PS. I thought I could fix it by binding txtTrackNum to a.trackNum, rather
than just trackNum, but then it complains it can't find that field.

Thanks,

Rowland.
Jul 17 '05 #1
2 1758
Have you tried aliasing the field? "Select a.TrackNum as Track_1,
b.TrackNum as Track_2..."?

David

"Rowland Banks" <ba*****@hotmai l.com> wrote in message news:<cd******* ***@sparta.btin ternet.com>...
Hi,

I've got two fields in seperate SQL tables (a and b), both called trackNum.
b.trackNum is a foriegn key into a.trackNum. I've got a form with a few
bound controls on it (textboxes specifically), one of which displays the
trackNum from the query "SELECT a.*, b.* FROM a, b WHERE a.trackNum =
b.trackNum". All of the controls are displaying their data correctly except
txtTrackNum, which is always displaying the digit 1. If I change my query so
that it only selects trackNum from a everything is hunky-dory. Anyone come
across this behaviour before?

PS. I thought I could fix it by binding txtTrackNum to a.trackNum, rather
than just trackNum, but then it complains it can't find that field.

Thanks,

Rowland.

Jul 17 '05 #2
That works great, thanks. I ended up using SELECT a.*, b.field1, b.field2,
etc. but I will definitely use your suggestion in future. I never knew you
could alias fields as well as tables. Thanks.

"David" <dh*******@ches tnut.org> wrote in message
news:83******** *************** ***@posting.goo gle.com...
Have you tried aliasing the field? "Select a.TrackNum as Track_1,
b.TrackNum as Track_2..."?

David

"Rowland Banks" <ba*****@hotmai l.com> wrote in message

news:<cd******* ***@sparta.btin ternet.com>...
Hi,

I've got two fields in seperate SQL tables (a and b), both called trackNum. b.trackNum is a foriegn key into a.trackNum. I've got a form with a few
bound controls on it (textboxes specifically), one of which displays the
trackNum from the query "SELECT a.*, b.* FROM a, b WHERE a.trackNum =
b.trackNum". All of the controls are displaying their data correctly except txtTrackNum, which is always displaying the digit 1. If I change my query so that it only selects trackNum from a everything is hunky-dory. Anyone come across this behaviour before?

PS. I thought I could fix it by binding txtTrackNum to a.trackNum, rather than just trackNum, but then it complains it can't find that field.

Thanks,

Rowland.

Jul 17 '05 #3

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

Similar topics

19
4101
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
14
10131
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought I should give back to the community by posting our findings. Thanks you all for all your help till now by posting problems and their solutions. ~Abhijit
4
2963
by: vulcaned | last post by:
Hi All, Hopefully I explain this well........ In Access97 I have a form which has a tab control on it, each tab has a sub-form which is bound to its appropriate table(I'll call them 'Detail' tables). I have a 'Header' table and fields from it are displayed on the form above the tab control. Header table name is tblClientInfo Detail tables are tblPolicyInfo, tblBeneInfo, tblRiderInfo
3
5003
by: MLH | last post by:
I have a form, bound to a query. Its RecordSource property is a query named frmEnterLienAmounts. The form has a few bound controls and some unbound controls. The unbound controls are calculated fields whose DefaultValue property is set to something like DLookUp("","tblVehicleJobs","=Forms!frmEnterLienAmounts!VehicleJobID") The form (frmEnterLienAmounts) has, as one of its bound fields . As I scroll through the records, one-
2
1607
by: H5N1 | last post by:
Hi there First of all excuse me posting such simple (I guess) question, but I didn't find the answer in tutorials. I have a formView presenting records from some table. one of the fields is a Category ID, which is a foreign key. in edit template I replace it with dropdownlist, which is gets this ID, and displays corresponding name, by getting information from other datasource.
0
1457
by: HP | last post by:
Hi there I have a datalist control with some bound controls in its Item Template and a gridview bound to one of those fields (residing also in Item Template). I've found out that when I click Edit on the gridview (same happens when editing other gridview which is outside the datalist) all datalist bound fields (except the gridview) disappear, and they don't appear after submitting GV changes - they do only after changing value of some
4
11566
by: Rico | last post by:
Hello, I have an MDE application where I use a bound object frame to display an image. This frame is updatable and bested on the contents of an OLE field. My problem is, some images display as the image and some display as an icon with the file name below. The process I'm following is as follows; Right click Choose "Insert Object..." Select "Create from File"
5
2592
by: njb35 | last post by:
Hi all I'm beginning my foray from VBA into VB 2005 Express, and enjoying some of the efficiencies it provides! I'm stuck with some dataset handling however that I _think_ can be automated but I can probably code what I want to do the hard way. I've searching around online but can't find an answer to this specific question. Here's the situation: I have a dataset table with 3 fields: one indexed as a primary key and the other two...
6
1856
by: Jonathan Wood | last post by:
I have a databound dropdownlist control. Based on some other criteria, I need to specify the selected item in my pages Load event. The problem is that, in my load event, the control does not yet have any data. I've found I can call DataBind() on that control and then it works okay. However, this has me wondering where the control normally databinds, and if me doing it manually would actually introduce the overhead of having the control...
0
8674
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
9028
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8895
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
7728
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...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2330
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.