I’ve created a data entry form for a survey using a table and form structure similar to that used in Duane Hookom’s “At Your Survey” database (
When a user selects a RspnsID on the main form (frmSurveyResponses), the matching record/controls appear in the subform (sfrmResponses). Likewise, if a user selects a new record on the main form, a blank data entry form appears in the subform. The forms are linked by RspnsID.
These are some of the controls in the detail section of the subform:
1. QstnText - the survey question
2. Rspns - a combo box with potential answers or blank, depending on the value in
the row source.
3. QstnID – not visible
4. LmtLst – not visible (Y/N, text box)
5. QstnMask – not visible (text box)
I’ve set up an event in the On Current property of the subform which correctly sets the LimitToList property - for each Rspns - to Yes or No, depending on the value for that particular response (in tblQuestions).
Me![Rspns].LimitToList = Me!LmtLst
However, I can’t seem to write a similar event to set the *Input Mask* for each response, if there is one. I used similar syntax to the LmtLst code above, but doing this sets the Input Mask for *every* response on the subform, regardless of whether or not that response has an Input Mask.
For example, there’s only one question for which I’d like to set an input mask (QstnID = 2, QstnText = Survey Date, QstnMask = !99/99/0000;;" ". But my current code assigns this input mask to every response on the subform. Here’s what I’m using now in the subform’s On Current event:
Me![Rspns].InputMask = Me!QstnMask
So I tried adding a new field to tblQuestions – QstnMaskYN (Y/N, text box) - and then set the value accordingly, and used an If Then statement, but that didn’t seem to make any difference:
If Me![QstnMaskYN] = True Then
Me![Rspns].InputMask = Me!QstnMask
End If
Any ideas? Thank you. (More info. below) – Kurt
My main form is based on:
*************************
SELECT DISTINCTROW tblSrvRspns.RspnsID FROM tblSrvRspns;
My subform is based on:
***********************
SELECT DISTINCTROW tblResponses.*, tblQuestions.QstnText, tblQuestions.LmtLst, tblQuestions.QstnMask FROM tblResponses RIGHT JOIN tblQuestions ON tblResponses.QstnID=tblQuestions.QstnID
The Row Source for Rspns is:
****************************
SELECT tblResponsesList.Rspns FROM tblResponsesList WHERE ((tblResponsesList.QstnID=Forms!frmSurveyResponses!sfrmResponses.Form!QstnID));
When a user selects a RspnsID on the main form (frmSurveyResponses), the matching record/controls appear in the subform (sfrmResponses). Likewise, if a user selects a new record on the main form, a blank data entry form appears in the subform. The forms are linked by RspnsID.
These are some of the controls in the detail section of the subform:
1. QstnText - the survey question
2. Rspns - a combo box with potential answers or blank, depending on the value in
the row source.
3. QstnID – not visible
4. LmtLst – not visible (Y/N, text box)
5. QstnMask – not visible (text box)
I’ve set up an event in the On Current property of the subform which correctly sets the LimitToList property - for each Rspns - to Yes or No, depending on the value for that particular response (in tblQuestions).
Me![Rspns].LimitToList = Me!LmtLst
However, I can’t seem to write a similar event to set the *Input Mask* for each response, if there is one. I used similar syntax to the LmtLst code above, but doing this sets the Input Mask for *every* response on the subform, regardless of whether or not that response has an Input Mask.
For example, there’s only one question for which I’d like to set an input mask (QstnID = 2, QstnText = Survey Date, QstnMask = !99/99/0000;;" ". But my current code assigns this input mask to every response on the subform. Here’s what I’m using now in the subform’s On Current event:
Me![Rspns].InputMask = Me!QstnMask
So I tried adding a new field to tblQuestions – QstnMaskYN (Y/N, text box) - and then set the value accordingly, and used an If Then statement, but that didn’t seem to make any difference:
If Me![QstnMaskYN] = True Then
Me![Rspns].InputMask = Me!QstnMask
End If
Any ideas? Thank you. (More info. below) – Kurt
My main form is based on:
*************************
SELECT DISTINCTROW tblSrvRspns.RspnsID FROM tblSrvRspns;
My subform is based on:
***********************
SELECT DISTINCTROW tblResponses.*, tblQuestions.QstnText, tblQuestions.LmtLst, tblQuestions.QstnMask FROM tblResponses RIGHT JOIN tblQuestions ON tblResponses.QstnID=tblQuestions.QstnID
The Row Source for Rspns is:
****************************
SELECT tblResponsesList.Rspns FROM tblResponsesList WHERE ((tblResponsesList.QstnID=Forms!frmSurveyResponses!sfrmResponses.Form!QstnID));