Mrs.Meeker
Registered User.
- Local time
- Today, 21:37
- Joined
- Mar 28, 2003
- Messages
- 172
I've been reading about blank records and have tried a few options found here but have not solved all my of problems. (I tried going to the table and making them required fields - didn' t like that, so I used Pat Hartmans 'if statement':
If IsNull(Name) Or IsNull(Office) Then
MsgBox "Record will not be save. Please enter required data", vbOKOnly
Cancel = True
End If
(I used this in the beforeupdate event according to her recommendation.) Here's the problem.
My database opens to a main menu, users select a "view projects" button which opens a master list. From here they select a project and press the view button. This opens the project details and from here they can fill out one of three surveys. Upon making their selection, the user form opens. This contains the survey number (which is generated at that point), the survey type and the project number. Users are required to fill in their name and office and press the next button.
If a user, for one reason or another, closes this form, the survey number is still generated. I would like to prevent that. I know I can disable the close button but what if they have realized they chose the wrong project. I would like the ability to add a cancel button which will remove the survey number and use it on the next user form.
This is the SQL on the query that creates the survey number:
INSERT INTO tblQuestionsResults ( QuestionID, PageCode, Answer, SurveyNumber )
SELECT tblQuestions.QuestionID, tblQuestions.PageCode, 0 AS answer1, tblNextSurveyNumber.NextSurveyNumber
FROM tblNextSurveyNumber, tblSurveyNumber INNER JOIN tblQuestions ON tblSurveyNumber.SurveyID = tblQuestions.SurveyID;
Is there anything I can do to correct this problem? By using the if statement in the BeforeUpdate event it prohibits the creation of blank records but I would like to also prohibit the creation of Survey Numbers.
thanks
Rhonda
If IsNull(Name) Or IsNull(Office) Then
MsgBox "Record will not be save. Please enter required data", vbOKOnly
Cancel = True
End If
(I used this in the beforeupdate event according to her recommendation.) Here's the problem.
My database opens to a main menu, users select a "view projects" button which opens a master list. From here they select a project and press the view button. This opens the project details and from here they can fill out one of three surveys. Upon making their selection, the user form opens. This contains the survey number (which is generated at that point), the survey type and the project number. Users are required to fill in their name and office and press the next button.
If a user, for one reason or another, closes this form, the survey number is still generated. I would like to prevent that. I know I can disable the close button but what if they have realized they chose the wrong project. I would like the ability to add a cancel button which will remove the survey number and use it on the next user form.
This is the SQL on the query that creates the survey number:
INSERT INTO tblQuestionsResults ( QuestionID, PageCode, Answer, SurveyNumber )
SELECT tblQuestions.QuestionID, tblQuestions.PageCode, 0 AS answer1, tblNextSurveyNumber.NextSurveyNumber
FROM tblNextSurveyNumber, tblSurveyNumber INNER JOIN tblQuestions ON tblSurveyNumber.SurveyID = tblQuestions.SurveyID;
Is there anything I can do to correct this problem? By using the if statement in the BeforeUpdate event it prohibits the creation of blank records but I would like to also prohibit the creation of Survey Numbers.
thanks
Rhonda
Last edited: