gary.newport
Registered User.
- Local time
- Today, 21:20
- Joined
- Oct 14, 2009
- Messages
- 79
I have 3 unbound fields on my form, entitled txtActivity, txtDate and txtLeader. The first and last are combo boxes and the middle one is a simple text box which allows for a date picker to be used.
The record source of the form is set to tblActivityStaffDate; the table on which I need this and all subforms to relate to.
You select the activity and the date. The SQL behind txtLeader looks at both these fields and limits the list of Leaders to those who have undertaken that activity on that date. If there are no leaders for that date then all leaders are given.
The table itself has 4 fields, three of these are directly related to the unbound fields above. The final field is the primary key and is used to relate this table to other tables in the structure.
I need a fourth field to show the primary field for the selected data. So if I choose Tennis on 24/03/2010 and it was lead by Frank it would show the value 24; it's primary key value.
I have placed this SQL as part of the VBA for the After Update on the txtLeader, txtDate and txtActivity fields.
But when I run the form it simply cycles through all of the values stored as primary fields.
Any ideas anyone?
The record source of the form is set to tblActivityStaffDate; the table on which I need this and all subforms to relate to.
You select the activity and the date. The SQL behind txtLeader looks at both these fields and limits the list of Leaders to those who have undertaken that activity on that date. If there are no leaders for that date then all leaders are given.
The table itself has 4 fields, three of these are directly related to the unbound fields above. The final field is the primary key and is used to relate this table to other tables in the structure.
I need a fourth field to show the primary field for the selected data. So if I choose Tennis on 24/03/2010 and it was lead by Frank it would show the value 24; it's primary key value.
I have placed this SQL as part of the VBA for the After Update on the txtLeader, txtDate and txtActivity fields.
Code:
SELECT tblActivityStaffDate.WeeklyActivity_ID FROM tblActivityStaffDate WHERE (((tblActivityStaffDate.Activity)=forms.frmNewRegister.txtActivity) And ((tblActivityStaffDate.[Staff Member])=forms.frmNewRegister.txtLeader) And ((tblActivityStaffDate.dteDate)=forms.frmNewRegister.txtDate)) GROUP BY tblActivityStaffDate.WeeklyActivity_ID;
But when I run the form it simply cycles through all of the values stored as primary fields.
Any ideas anyone?
