I have a questions database. When user is filling out the form, the following fields are required: Questions, Author, Type of Question and Answer selected. Answer is selected by clicking on the button next to the Answers. If these fields are not filled out, a user gets a prompt saying that so and so field is blank. If have a problem, it works for all required fields except for Answer. Below is my code. I have attached a screenshot with Author and Answers blank. I only get a warning about the Author and not the Answers.
[imgnothumb]http://bytes.com/attachment.php? attachmentid=75 81[/imgnothumb]
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer) nullerr = 0 strnull = "" If IsNull(Me.txtQuestion) Then nullerr = 1 strnull = "Questions " & vbNewLine End If If IsNull(Me.txtAuthor) Then nullerr = 1 strnull = strnull & "Author " & vbNewLine End If If IsNull(Me.comboType) Then nullerr = 1 strnull = strnull & "Type " & vbNewLine End If If IsNull(Me.toggleA) Or IsNull(Me.toggleB) Or IsNull(Me.toggleC) Or IsNull(Me.toggleD) Then nullerr = 1 strnull = strnull & "Answer" End If If nullerr Then MsgBox "These fields cannot be left blank: " & vbNewLine & strnull DoCmd.RunCommand acCmdUndo End If
Comment