title: Opening one form from another form and closing original form from command click
body: <p>I have created a log in form that when the "Open Database" button is clicked opens another form. I am trying to get the original form "UserInformation" to close when the button is clicked to open the other form. I am trying all kinds of VBA code and nothing seems to be working. I created the button through the wizard and then converted the macro to vba code.</p>
  
  <pre><code>Private Sub cmdOpenDatabase_Click()
  
  If IsNull(Me.txtFirstName) Then
  MsgBox ("Please enter First Name")
  Me.txtFirstName.SetFocus
  Cancel = True
  Exit Sub
  End If
  
  If IsNull(Me.txtLastName) Then
  MsgBox ("Please enter Last Name")
  Me.txtLastName.SetFocus
  Cancel = True
  Exit Sub
  End If
  
  If IsNull(Me.txtEmployee) Then
  MsgBox ("Please enter Employee ID")
  Me.txtEmployee.SetFocus
  Cancel = True
  Exit Sub
  End If
  
  On Error GoTo cmdOpenDatabase_Click_Err
  
      DoCmd.OpenForm "Standards", acNormal, "", "", , acNormal
  
  cmdOpenDatabase_Click_Exit:
      Exit Sub
  
  cmdOpenDatabase_Click_Err:
      MsgBox Error$
      Resume cmdOpenDatabase_Click_Exit
  
  End Sub
  </code></pre>