A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Variable as FieldName to populate a combobox



 
 
Thread Tools Display Modes
  #1  
Old January 17th, 2010, 03:14 PM posted to microsoft.public.access.queries
Matt Shiells-Jones
external usenet poster
 
Posts: 1
Default Variable as FieldName to populate a combobox

OKay - this is probably really reall easy but I cannot for the life of me figure it out...

I have 3 tables that I want to cross reference (sort of) -

Table 1 - students, contains fields that specify the training they are to attend - so Everyone, Credit Control etc... - these are all Yes/No fields for easy updating of what training is required for an individual.


Table 2 - the courses, stored with coursename and unique ID

Table 3 - course attendance - contains a student ID and course ID to link a student to a course.


What I want is this (most is already done, just stuck on a dropdown list!)...

The name of the course is stored in a field on the form 'frmCourseSchedule' as the field 'CourseName'. I want to use the value of this field to limit the list of available students in the dropdown list according to whether or not they need the course, and whether or not they have attended:

I need something like:
SELECT FirstName FROM tblStudents WHERE [Forms!frmCourseSchedule.CourseName] = True

So if I wanted to assign people for the 'Everyone' Module the above query would limit to only people who have 'TRUE' in the 'Everyone' field of their record...


can anyone explain how to do this as its driving me mad - I am very proficient but this has really got me flummoxed - how would I then get this to execute in a query?


Submitted via EggHeadCafe - Software Developer Portal of Choice
SQL Server Dynamic WHERE clause without exec
http://www.eggheadcafe.com/tutorials...mic-where.aspx
  #2  
Old January 17th, 2010, 08:02 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Variable as FieldName to populate a combobox

If you have training names as field names, then IMO your table structure is
wrong. You need to normalize so you won't have to ask how to get field names
into a combo box. You will more easily be able to display field values once
your tables are set up correctly.

--
Duane Hookom
Microsoft Access MVP


"Matt Shiells-Jones" wrote:

OKay - this is probably really reall easy but I cannot for the life of me figure it out...

I have 3 tables that I want to cross reference (sort of) -

Table 1 - students, contains fields that specify the training they are to attend - so Everyone, Credit Control etc... - these are all Yes/No fields for easy updating of what training is required for an individual.


Table 2 - the courses, stored with coursename and unique ID

Table 3 - course attendance - contains a student ID and course ID to link a student to a course.


What I want is this (most is already done, just stuck on a dropdown list!)...

The name of the course is stored in a field on the form 'frmCourseSchedule' as the field 'CourseName'. I want to use the value of this field to limit the list of available students in the dropdown list according to whether or not they need the course, and whether or not they have attended:

I need something like:
SELECT FirstName FROM tblStudents WHERE [Forms!frmCourseSchedule.CourseName] = True

So if I wanted to assign people for the 'Everyone' Module the above query would limit to only people who have 'TRUE' in the 'Everyone' field of their record...


can anyone explain how to do this as its driving me mad - I am very proficient but this has really got me flummoxed - how would I then get this to execute in a query?


Submitted via EggHeadCafe - Software Developer Portal of Choice
SQL Server Dynamic WHERE clause without exec
http://www.eggheadcafe.com/tutorials...mic-where.aspx
.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:42 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.