Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / April 2005

Tip: Looking for answers? Try searching our database.

form survey question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
i am lost in the sauce - 18 Apr 2005 15:09 GMT
i am designing my form for my survey and i want to be able to let people know
when they missed a question to go back and fill it out.  how would i go about
that?
Sprinks - 18 Apr 2005 15:28 GMT
One way to do this is using the BeforeUpdate event of the form.  You can loop
through all of your form controls to make sure they aren't null.  Once you
find one, you can display a message, cancel the record Add, and place the
focus back on the control.  You can either use the ControlSource property of
each control to display the name of the underlying field in your message, or
the Tag property to hold more custom text.  

Note that the check for Null will not catch a check box type of control for
a Yes/No field that has not been checked, because it has a value of False.

Dim ctl As Control

  For Each ctl In Me.Controls
    ' See VBA Help for the VB Constants for other data entry controls you
    ' might be using on your form
    If (ctl.ControlType = acTextBox Or ctl.ControlType = acComboBox Or _
        ctl.ControlType = acListBox) Then
             If IsNull(ctl) Then
                  Cancel = True
                  MsgBox "Please enter a value for " & ctl.ControlSource
                  ' Or, alternatively:
                  ' MsgBox "Please enter a value for " & ctl.Tag
                  ctl.SetFocus
                  Exit Sub
             End If
    End If
   
  Next ctl

Hope that helps.
Sprinks

> i am designing my form for my survey and i want to be able to let people know
> when they missed a question to go back and fill it out.  how would i go about
> that?
BruceM - 18 Apr 2005 20:32 GMT
Exactly the sort of thing I was going to be asking soon.  Thanks, even though
I'm not the one who asked the initial question.

> One way to do this is using the BeforeUpdate event of the form.  You can loop
> through all of your form controls to make sure they aren't null.  Once you
[quoted text clipped - 31 lines]
> > when they missed a question to go back and fill it out.  how would i go about
> > that?
i am lost in the sauce - 19 Apr 2005 17:17 GMT
what if i dont know any vb or vba.  in other words where would i look on my
form for the stuff you told me to do and when i find it how do i put in my vb
code for each one.  it looks fairly easy so that must mean its not.  if you
could help i would greatly appriciate it.  thanks

> One way to do this is using the BeforeUpdate event of the form.  You can loop
> through all of your form controls to make sure they aren't null.  Once you
[quoted text clipped - 31 lines]
> > when they missed a question to go back and fill it out.  how would i go about
> > that?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.