Private Sub Command5_Click()
Dim sql As String
DoCmd.OpenForm "窗体1"
sql = "SELECT * FROM 入库单 "
sql = sql + "WHERE 入库单.入库日期>=[Forms]![入库单按入库日期选择]![rq1] And 入库单.入库日期<=[Forms]![入库单按入库日期选择]![rq2];"
Forms!窗体1![入库单 子窗体].Form.RecordSource = sql
Forms!窗体1![入库单 子窗体].Requery
End Sub
Private Sub Command5_Click()
Dim strSQL As String
Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is TextBox Then
If IsNull(ctl) Then
MsgBox "enter the date into the " & ctl.Name
ctl.SetFocus
Exit Sub
End If
End If
Next
strSQL = "select * from 入库单 where 入库日期 between #" & Me.rq1 & "# And #" & _
Me.rq2 & "#"
DoCmd.OpenForm "窗体1"
Forms!窗体1![入库单 子窗体].Form.RecordSource = strSQL
End Sub