Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2002
    Location
    Charlotte, NC
    Posts
    45

    Lightbulb Unanswered: Quick Subform Question

    I have a form with a subform.

    The subform returns one value in the subforms textbox called test .

    On my form.. I have one button.

    Can someone help me with the code to do the following:

    When you click the button I need it to check the subform value..

    if 0.. Me.Textbox.IsVisible = True

    else Me.Textbox.IsVisble = False

    Thanks for any help.
    -----

    "How much deeper would the ocean be without sponges?"

  2. #2
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665

    Re: Quick Subform Question

    Originally posted by stratego16
    I have a form with a subform.

    The subform returns one value in the subforms textbox called test .

    On my form.. I have one button.

    Can someone help me with the code to do the following:

    When you click the button I need it to check the subform value..

    if 0.. Me.Textbox.IsVisible = True

    else Me.Textbox.IsVisble = False

    Thanks for any help.
    try something like
    if subform![form]![test] = 0 then
    form![textbox].visable = true
    elseif subform![form]![test] <> 0 then
    form![Textbox].visable = false
    end if

    jim

  3. #3
    Join Date
    Oct 2002
    Location
    Charlotte, NC
    Posts
    45

    Error I get

    If SubForm![Question_Number_Subform]![test] = 0 Then
    Me.WarningLabel1.Visible = True

    ElseIf SubForm![Question_Number_Subform]![test] <> 0 Then
    clear_table ("CorrectAnswers")
    Me.WarningLabel1.Visible = False
    DoCmd.OpenReport "Generated_Test", acViewPreview

    End If

    ----

    I get an Object Required error.. with the first line being highlighted.
    Any Ideas?
    -----

    "How much deeper would the ocean be without sponges?"

  4. #4
    Join Date
    Oct 2002
    Location
    Charlotte, NC
    Posts
    45

    Exclamation Got It

    Thanks Jim,

    But I tweaked it a little and got it.

    -----

    If Me!Question_Number_Subform!test = 0 Then
    Me.WarningLabel1.Visible = True

    ElseIf Me!Question_Number_Subform!test <> 0 Then
    clear_table ("CorrectAnswers")
    Me.WarningLabel1.Visible = False
    DoCmd.OpenReport "Generated_Test", acViewPreview

    End if
    -----

    "How much deeper would the ocean be without sponges?"

  5. #5
    Join Date
    Aug 2002
    Location
    Charlotte NC
    Posts
    665
    Great!!! Glad you got it
    Jim

  6. #6
    Join Date
    Jan 2004
    Posts
    44

    re

    I'm actually trying to accomplish something similar. I'm trying to have subforms within a form be visable only when a combo box on the form equals a given number, i.e. combo = 3, 3 subforms visable.

    I was trying to use the following just to test:

    Private Sub Form_Open(Cancel As Integer)

    If SubForm![DRAC Database]![Combo6] = 0 Then
    Form![DRAC Database]![207028].visable = False
    ElseIf [DRAC Database]![Combo6] = 1 Then
    [DRAC Database]![207028].visable = True
    End If

    but I keep getting the following error:

    Run-time error '424'
    Object Required

    I dont really know VBA so I'm kinda lost.
    Appreciate any help.

Posting Permissions

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