Results 1 to 6 of 6
  1. #1
    Kevo is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Location
    Kodiak, Alaska
    Posts
    86

    If Then - for a control on form and control on subform?

    Hi,
    I want an If then that fires a MsgBox if a control on my mainform is null and a control on the subform is not null.

    Any help would be appreciated


    Here is what I have tried:



    If Not IsNull(Forms!frmLoad!frmLoadDetails_subform.cboImp lants) And Me.btnPCD = No Then
    MsgBox "Implants - Must include PCD in load!", vbExclamation

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Try:
    Code:
    If Not IsNull(Me.frmLoadDetails_subform.Form.[cboImp lants]) And IsNull(Me.btnPCD) Then
    MsgBox "Implants - Must include PCD in load!", vbExclamation
    EndIf
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Kevo is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Location
    Kodiak, Alaska
    Posts
    86

    Smile

    Quote Originally Posted by Bob Fitz View Post
    Try:
    Code:
    If Not IsNull(Me.frmLoadDetails_subform.Form.[cboImp lants]) And IsNull(Me.btnPCD) Then
    MsgBox "Implants - Must include PCD in load!", vbExclamation
    EndIf

    Sorry, this isn't working for me.

    The [cboImplants] is a combo box on the subform. Should I be "checking" the table column for the Not IS NUll instead?

    I have this already on the click event of the "close" button on the main form
    If Me.LoadNumber = "1" And Me.BI = NO Then
    MsgBox "Biological Indicator Needed - 1st Load of Day!", vbExclamation
    DoCmd.CancelEvent
    Else
    DoCmd.Close
    End If

    This works great, but of course it is referencing 2 controls that are on the main form.

    I now want the additional function from my original post. I also have a third If then I will eventually want to add as well...

    1) The part that is working (above), is checking to see if this is the first load of the day and if so, is the BI (Biological Indicator) button checked.

    2) I also want to check to see if there are any "Implants" in the load (which is on the subform) and if so, is the PCD button checked.

    3) Lastly check to see if any of the "Instruments" in the load require a special cycle, check cycle parameter combobox.

    These last 2 things require checking either subform or checking record in table itself (neither of which I seem to know how to do) as well as checking control on main form (easy part)

    Sorry so long, thought it might help.

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    What kind of control is Me.btnPCD
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    Kevo is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2011
    Location
    Kodiak, Alaska
    Posts
    86
    Thanks for the reply Bob!

    btnPCD is a checkbox on the main form.

  6. #6
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Quote Originally Posted by Kevo View Post
    Thanks for the reply Bob!
    btnPCD is a checkbox on the main form.
    Then try:
    Code:
    If Not IsNull(Me.frmLoadDetails_subform.Form.[cboImplants]) And Me.btnPCD = False Then
    MsgBox "Implants - Must include PCD in load!", vbExclamation
    EndIf
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 03-29-2012, 12:40 PM
  2. Replies: 3
    Last Post: 03-02-2012, 03:27 PM
  3. Hide each control, control group or subform?
    By BRV in forum Programming
    Replies: 2
    Last Post: 12-09-2011, 09:36 AM
  4. Replies: 5
    Last Post: 10-13-2011, 03:36 PM
  5. Form/Subform Control
    By Dan Kenton in forum Forms
    Replies: 11
    Last Post: 03-20-2011, 03:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums