Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command button on subform detail row not passing ID

Status
Not open for further replies.

traycee

IS-IT--Management
Sep 6, 2001
245
US
I have a very simple database. Client table connects one-to-many to attendee table and Attendee table has a one-to-many relationship with Survey table.

Client is the main form (single form) with Attendee as the subform (continuous form). I'd like to put a button on the detail row so when you click it the survey form opens with the correct attendee, which it does do. However, it doesn't fill in the attendeeid field in the survey table. Any clue to what I may be missing or is this not possible?
 
Thanks for replying. The code below is the query behind my survey form.

SELECT SatisfactionSurvey.SurveyID, SatisfactionSurvey.AttendeeID, SatisfactionSurvey.Session, SatisfactionSurvey.Question1, SatisfactionSurvey.Question2, SatisfactionSurvey.Question3, SatisfactionSurvey.Question4, SatisfactionSurvey.Question5, SatisfactionSurvey.Question6, SatisfactionSurvey.Question7, SatisfactionSurvey.Question8, SatisfactionSurvey.Question9, SatisfactionSurvey.Question10, SatisfactionSurvey.Question11, SatisfactionSurvey.Question12, SatisfactionSurvey.Question13, SatisfactionSurvey.Question14, SatisfactionSurvey.Question15, SatisfactionSurvey.Question16
FROM Attendee INNER JOIN SatisfactionSurvey ON Attendee.AttendeeID = SatisfactionSurvey.AttendeeID
WHERE (((SatisfactionSurvey.AttendeeID)=[Forms]![Class]![Attendee Subform].[Form]![AttendeeID]));

Under the attendeeid column of the query in the criteria area I have [Forms]![Class]![Attendee Subform].[Form]![AttendeeID]. On the survey form, in the attendeeid control I put the same. When I click on the command button, the form does show the correct ID number. It's just not storing it in the attendeeid field of the table. If this makes sense. Not sure if I'm explaining myself very well.


 
If you click the button, does it open the subform for the correct AttendeeID if there are already survey records? If not, your focus in the subform is probabl off.

I would use code in the On Open event to set the value of the attendeeID to the same value as [Forms]![Class]![Attendee Subform].[Form]![AttendeeID]. Actually I would probably use OpenArgs in the DoCmd.OpenForm to send the appropriate AttendeeID to the survey form.

Duane
Hook'D on Access
MS Access MVP
 
That's the weird thing. When I click the button to open the Survey form it does open with the correct attendeeid showing in the attendeeid field. But it leaves the attendeeid field blank in the table.
 
There won't be a value for attendeeID unless you set it. That's why I suggested you add code to the on open event. If the form is a subform, you can use the link master/child properties to do this.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top