By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,705 Members | 1,891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,705 IT Pros & Developers. It's quick & easy.

Problem populating text box with query

Lensmeister
P: 15
Hi,

As a newbie here I hope someone cane help me.

I have Acess 2003 and am making a database that holds records or football matches. I haven't created any relationships as yet. The main table is called tbl_Matches and the Primary key is an auto number. In this table I have the following fields I am using in a query (there are other fields in the table but not used in the query).

Expand|Select|Wrap|Line Numbers
  1. [Home] 
  2. [HG] 
  3. [Away]
  4. [AG]
In the query I am using the table tbl_Matches I have a caluculation that says

Expand|Select|Wrap|Line Numbers
  1. IIF([HG]>[AG],[Home],[Away])
The only column that shows is the answer.

This is producing the correct answer I want.

I have a form (frm_Matches) that has all the fields for the tbl)Meatches on it. Now this is where I get some problems.

I want a textbox to show the result of the Query (qry_WinTeam) to appear in it.

I have tried a few things and am now stuck. Please help if you can.
Feb 18 '09 #1
Share this Question
Share on Google+
6 Replies


NeoPa
Expert Mod 15k+
P: 31,411
Build the query (qry_WinTeam) to show all the values of the form, then bind the form to this query instead of the table. It will be display only.

Otherwise, have an unbound TextBox which simply uses the same formula to show [HG] or [AG] as selected.
Feb 18 '09 #2

NeoPa
Expert Mod 15k+
P: 31,411
It looks like you may be having problems designing the table structure in a sustainable way (you may find things it can't do for you later because the design has not been properly considered now). I suspect you will want details of what the results of the games were etc. The data needs to be stored at the lowest logical level. This way higher stuff can be deduced using queries etc.

I recommend you take a quick look through Normalisation and Table structures.

PS. Welcome to Bytes! (It seems you don't live a million miles from me :D)
Feb 18 '09 #3

Lensmeister
P: 15
@NeoPa

I have added a textbox. I have added the

Expand|Select|Wrap|Line Numbers
  1. IIF([HG]>[AG],[Home],[Away]) 
What property of the Textbox do I add this to?

I did add it to one (default value) but as I moved from record to record it did not update.

Sorry for sound daft.

I live in Croydon .... :( Thanks for the welcome.
Feb 18 '09 #4

NeoPa
Expert Mod 15k+
P: 31,411
Try (in the Control Source property) :
Expand|Select|Wrap|Line Numbers
  1. =IIf([HG]>[AG],[Home],[Away])
Feb 18 '09 #5

Lensmeister
P: 15
Ok got it now ....

Thanks a lot.

saw the Control Source property now.

Thanks again.

I may have some other daft questions soon enough. LOL
Feb 18 '09 #6

NeoPa
Expert Mod 15k+
P: 31,411
I look forward to seeing them.
Feb 18 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.