473,386 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 1749
Have you tried aliasing the field? "Select a.TrackNum as Track_1,
b.TrackNum as Track_2..."?

David

"Rowland Banks" <ba*****@hotmail.com> wrote in message news:<cd**********@sparta.btinternet.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*******@chestnut.org> wrote in message
news:83**************************@posting.google.c om...
Have you tried aliasing the field? "Select a.TrackNum as Track_1,
b.TrackNum as Track_2..."?

David

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

news:<cd**********@sparta.btinternet.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
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...
14
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...
4
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'...
3
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...
2
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...
0
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...
4
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...
5
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...
6
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.