Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2015
    Posts
    15

    Answered: SUB form adressing in VBA

    So, i try to put in a msg box warning when somebody clicks the save button, when they have marked yes for "REK" but forgot to fill in the "RekNr"

    Problem is, the save button is in the main form, and "rek" and "reknr" is in a sub form. So how do I adress this right?

    This code below did not work, but any suggestions?

    Code:
    If Me.sub-form.Rek And Len(Me.RekNr.Value & " ") = 1 Then

    Feilstreng = Feilstreng + "- Du har glemt fylle ut RekNr" + vbNewLine


    Me.sub-form.RekNr.SetFocus

    End If

  2. Best Answer
    Posted by ranman256

    "Use the builder...this will get the syntax correct. You just pick it.
    But I think it will be...
    If Me.sub-form.forms.Rek And isnull(Me.RekNr.Value) Then"


  3. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    Use the builder...this will get the syntax correct. You just pick it.
    But I think it will be...
    If Me.sub-form.forms.Rek And isnull(Me.RekNr.Value) Then

  4. #3
    Join Date
    Mar 2015
    Posts
    15
    Quote Originally Posted by ranman256 View Post
    Use the builder...this will get the syntax correct. You just pick it.
    But I think it will be...
    If Me.sub-form.forms.Rek And isnull(Me.RekNr.Value) Then
    Almost, had to change - to _ and it worked =)

Posting Permissions

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