this seems so easy, but it has stumped me all day!<br><br>i have a form where the user enters their name and password called frmName. then, they click ok and opens up another form i call frmSwitchboard. <br><br>the OnOpen event of the frmSwitchboard triggers another form to be opened that is based on a query. that form is called frmConstraint and the query it is based on is called qryConstraint. <br><br>sometimes the frmConstraint will contain data, sometimes it won't . all i want is for the form to open when there is data and to never open if it is empty. the tricky part is that the query qryConstraint has a parameter based on the name from frmName.<br><br>i have tried:<br><br>Dim db As Database<br>Dim rec As Recordset<br>Dim criteria As String<br><br>Set db = CurrentDb()<br>criteria = Chr(34) & Forms![frmName]![cboName] & Chr(34)<br>Set rec = db.OpenRecordset("qryConstraint"
<br><br> DoCmd.OpenForm "frmConstraint", , , "[engineer]= " & criteria & " ", acFormReadOnly, acDialog<br>rec.MoveLast<br>If rec.RecordCount < 0 Then<br> DoCmd.Close acForm, "frmConstraint"<br> End If<br>rec.Close<br><br>any suggestions? i have spent almost all day on this!!