需要显示错误提示采用以下代码:
Private Sub D_SERIAL_NUMBER_DblClick(Cancel As Integer)
On Error GoTo Err_D_SERIAL_NUMBER_DblClick
Dim sql As String
Dim MYDB As Database
Set MYDB = CurrentDb()
sql = "SELECT * FROM [d history] "
sql = sql & "WHERE [d history].[D SERIAL NUMBER] LIKE '" & [D SERIAL NUMBER] & "';"
DoCmd.OpenForm "D_HISTORY", acFormDS
Forms![D_HISTORY].RecordSource = sql
Exit_D_SERIAL_NUMBER_DblClick:
Exit Sub
Err_D_SERIAL_NUMBER_DblClick:
MsgBox Err.Description
Resume Exit_D_SERIAL_NUMBER_DblClick
End Sub
[此贴子已经被作者于2006-1-13 19:15:27编辑过]
|