Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2009
    Posts
    10

    Question Unanswered: Superimposed text boxes

    I have a form that has two sets of superimposed text boxes.

    The fields are named SeasonalStartDate, SeasonalEndDate, OnLeaveStartDate, and OnLeaveEndDate.

    See uploaded file NotSupIm.jpg - Not super imposed for clarity

    Then take a look at SupImp.jpg - Form View

    Finally look at SupImpDe.jpg - Current design view.

    My dilemma is that when viewing in this form in form view, and scrolling through the 102 records currently entered. Those individuals who have been checked boxed as Seasonal, are the only individuals that actually show the SeasonalStartDate and SeasonalEndDates.

    Whenever I look up an individual that is currently "On Leave", the OnLeaveStartDate and OnLeaveEndDates never appear.

    The assigned On Leave dates are in the referenced table of data and I can print a report that will show both those on leave and those that are on seasonal leave.

    Of course if I move in design mode the text boxes so they are NOT superimposed, the OnLeaveStartDate, OnLeaveEndDates appear when scrolling through the database.

    Properties:

    All of these text boxes are marked "yes" for "Visible".

    Here is a snipet of code that I believe which I believe should work in making the appropriate text boxes visible in form view:

    Private Sub OnLeaveStartDate_GotFocus()

    If chkOnLeave = True Then
    [OnLeaveStartDate].Visible = True
    Me.SeasonalStartDate.Visible = False

    End If
    End Sub

    Private Sub OnLeaveStartDate_LostFocus()

    If chkOnLeave = True Then
    [OnLeaveStartDate].Visible = True
    Me.SeasonalStartDate.Visible = False

    End If
    End Sub

    Private Sub OnLeaveEndDate_GotFocus()

    If chkOnLeave = True Then
    [OnLeaveEndDate].Visible = True
    Me.SeasonalEndDate.Visible = False

    End If
    End Sub

    Private Sub OnLeaveEndDate_LostFocus()

    If chkOnLeave = True Then
    [OnLeaveEndDate].Visible = True
    Me.SeasonalEndDate.Visible = False

    End If

    The same code is used for Seasonal:


    Private Sub SeasonalEndDate_GotFocus()

    If chkSeasonal = True Then
    [SeasonalEndDate].Visible = True
    Me.OnLeaveEndDate.Visible = False

    End If
    End Sub

    Private Sub SeasonalEndDate_LostFocus()

    If chkSeasonal = True Then
    [SeasonalEndDate].Visible = True
    Me.OnLeaveEndDate.Visible = False

    End If
    End Sub

    Private Sub SeasonalStartDate_GotFocus()

    If chkSeasonal = True Then
    [SeasonalStartDate].Visible = True
    Me.OnLeaveStartDate.Visible = False

    End If
    End Sub

    Private Sub SeasonalStartDate_LostFocus()

    If chkSeasonal = True Then
    [SeasonalStartDate].Visible = True
    Me.OnLeaveStartDate.Visible = False

    End If
    End Sub

    Is it impossible to have superimposed text boxes in Access 2007?

    What command do I have imploy to make it happen?

    Frustrated in Utah.

    Mahonri
    Attached Thumbnails Attached Thumbnails SupImp.bmp   NotSupIm.bmp   SupImpDe.bmp  
    Last edited by Mahonri1; 06-24-09 at 15:13. Reason: Didn't see link for attachments???

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Rather than the focus events, I would have code in two basic places. First, the after update event of the checkbox, changing the visibility based on the status of the box. That updates the visibility as the user makes changes to the record. Second, the current event of the form, so that the settings are correct as you change records.
    Paul

  3. #3
    Join Date
    Jun 2009
    Posts
    10
    Could you elaborate on your "Second, the current event of the form, so that the settings are correct as you change records.?

    Remember I said that the data is already in the associated table and that if I move the "OnLeaveStartDate" and "OnLeaveEndDate" textboxes such that there four viewable text boxes on the form, the dates appear.

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Access is very event driven. The 2 events most relevant to you here are the changing of the checkbox value, and the current event. Changing the checkbox value obviously because that is what determines the visibility of the textboxes. After you've set those values for one record, if you go to another record and its checkbox value is different, the visibility of your controls is off. So, you put code in the current event to set the visibility of the controls appropriate to the checkbox value of the current record. Basically:

    Code:
    If Me.chkSeasonal = True Then
      Me.SeasonalEndDate.Visible = True
    Else
      Me.SeasonalEndDate.Visible = False
    End If
    I suspect your use of the focus events was an attempt to do what is more easily done in the current event.
    Paul

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •