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 / Forms Programming / March 2006

Tip: Looking for answers? Try searching our database.

Show label only if fields in subform are not null

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
nerb61 - 31 Mar 2006 18:08 GMT
I want to display a label on my main form only when certain fields on my
subform are not null. I know my code is incorrect, but I need help making it
right. Thanks in advance.

Sub ShowIssueComplete()

If Me.frmQuestions.Response1.IsNull = True
  Me.frmQuestions.Response2.IsNull = True
  Me.frmQuestions.Response3.IsNull = True
  Me.frmQuestions.Response4.IsNull = True
  Me.frmQuestions.Response5.IsNull = True
  Me.frmQuestions.Response6.IsNull = True
 
Then
  Me.lbDecisionComplete.Visible = True

Else
  Me.lbDecisionComplete.Visible = False

End If

End Sub
Barry Gilbert - 31 Mar 2006 18:44 GMT
Try this:
Sub ShowIssueComplete()

If IsNull(Me.frmQuestions.Form.Response1) And _
  IsNull(Me.frmQuestions.Form.Response2) And _
  IsNull(Me.frmQuestions.Form.Response3) And _
  IsNull(Me.frmQuestions.Form.Response4)l And _
  IsNull(Me.frmQuestions.Form.Response5) And _
  IsNull(Me.frmQuestions.Form.Response6) Then

  Me.lbDecisionComplete.Visible = True

Else
  Me.lbDecisionComplete.Visible = False

End If

End Sub

It assumes you want the Visibility based on all fields being null. If
not, replace the ANDs with ORs.

Barry
Klatuu - 31 Mar 2006 20:11 GMT
Here is a little technique that will minimize the amount of coding you will
need.

Dim intCtr As Integer
Dim blnMakeVisible as Boolean

   blnMakeVisible = True
   With Me.frmQuestions
       For intCtr = 1 to 6
       If Not IsNull(.Controls("Response" & Cstr(intCtr))) Then
           blnMakeVisible = False
           Exit For
       End If
   End With
   Me.lbDecisionComplete.Visible = blnMakeVisible

> I want to display a label on my main form only when certain fields on my
> subform are not null. I know my code is incorrect, but I need help making it
[quoted text clipped - 18 lines]
>
> End Sub
 
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.