Results 1 to 2 of 2
  1. #1
    Join Date
    May 2002

    Unhappy Unanswered: Re: referencing a control in the subform

    Hi everyone:

    I have main form and a subform. Within the subform I created a temp table use as the subform’s recordsource.
    When the main form closes the temp table needs to be deleted. (This is working fine)
    However if a recordset is not created or no temp table is not created I just want to close the forms without deleting the temp tbl.(The part is what I need to modify my code)
    What I want to do is when cancel button is clicked in the main form I need to check if a field in the subform is populated, say bag_num but it is given the following error:

    Ms VB:
    Run-time error
    You entered an expression that has no value.

    My code:
    Private Sub cmdCancel_Click()
    On Error GoTo Err_cmdCancel_Click
    Dim str As String, ret_val As Integer

    -->If Not IsNull(Me!start_inspection_list!bag_num.Value) Then
    -->If Me!start_inspection_list!bag_num.Value <> "" Then
    Error above occurs here

    str = "DROP TABLE tblTmp_inspec;"
    DoCmd.RunSQL str
    End If
    DoCmd.close acForm, "start_inspection"

    Exit Sub
    Resume Exit_cmdCancel_Click
    End Sub


  2. #2
    Join Date
    Sep 2004
    I think it's because bag_num is a field of your recordset and no records exist.

Posting Permissions

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