• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 523
  • Last Modified:

Go to first record in a table with an empty field MS Access

I have an Access database that has a form with a textbox on it. The textbox is for users to type answers to questions in. The user will read a question and type his or her answer in the textbox. The user will then click a command button to move on to the next question. I am allowing questions to be skipped over and returned to at a later time if an immediate answer is not available.  When the user reaches the end (there are 10 questions), he or she will click a command button to exit. Under the command button, I have code that checks if all questions have not been answered. If they haven't all been answered, a vbYesNo messagebox notifies the user that all questions have not been answered and asks him or her whether (s)he would like to continue  answering questions (vbYes) or whether (s)he would like to exit and return at a later time (vbNo).

So, under the vbYes code, I want to jump to the first unanswered question (going from 1 to 10) and place the cursor in the textbox for the user to type in an answer.

The form's record source is Table1

Table1 has 2 fields.   The first field is the QuestionNumber (all records in this field are already populated...i.e. 1 thru 10).  The second field is QuestionAnswer, which is a memo field. The control source of the textbox on the form is QuestionAnswer.

So, as an example, let's say the user answers some of the questions. The table might then look like this:

QuestionNumber         QuestionAnswer
1                                     bla bla bla                            
4                                     bla bla bla
5                                     bla bla bla

Now, let's say the user gets to the end, presses the exit button, is presented with a vbYesNo message as to whether (s)he wants to continue or not, and selects yes.   I want to then have the program jump to question number 2 (the first unanswered question in sorted order) and place the cursor in the textbox for the user to answer question number 2.  What do I put under the vbYes path to get the program to jump to the first record in the table where the QuestionAnswer field is blank? Thank you.
1 Solution
Try this:
Me.Recordset.FindFirst "[QuestionNumber] is Null"
dbfromnewjerseyAuthor Commented:

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now