|
本帖最后由 Lightsome 于 2010-10-8 10:47 编辑
对表BB,做了一个查询qryBB,只查询W为-1的数据。
BB dEHW
01-A10-AYYY6551615-3S-1
01-A11-ASSS6551615-1S-1
01-A12-AFFF6551615-5S-1
01-A10-BYYY-SD6551615-4S-1
01-A10-CYYY-SD16551615-5S-1
在窗体frmBB中,进行模糊查询"a10",得出三条记录
frmBB_sub dEHW
01-A10-AYYY6551615-3S-1
01-A10-BYYY-SD6551615-4S-1
01-A10-CYYY-SD16551615-5S-1
双击d列中的其中一条记录,会弹出一个窗口,按SAVE键后,用代码将该记录的W值改为False值。保存后按CLOSE键退出,回到主窗体。
我希望回到主窗体后,主窗体中的子窗体中的记录能自动更新,即只显示二条记录,请问如何做到?多谢多谢!
弹出窗体中的代码:
Option Compare Database
Private Sub btmSave_Click()
On Error GoTo Err_btmSave_Click
Dim strPeriod As String
Dim strPN As String
Dim n As String
strPeriod = CurrentPeriod
strPN = Me.d
stDocName_1 = "update BB SET BB.W=FALSE WHERE (((BB.D)= '" & strPN & "'))"
CurrentDb.Execute stDocName_1
Me.d.SetFocus
Me.btmSave.Enabled = False
Exit_btmSave_Click:
Exit Sub
Err_btmSave_Click:
MsgBox Err.Description
Resume Exit_btmSave_Click
End Sub
Private Sub btmClose_Click()
On Error GoTo Err_btmClose_Click
Dim n As String
If Me.btmSave.Enabled = False Then
DoCmd.Close
Forms("frmBB").Requery
Else
Response = MsgBox("Data has not been saved, Do you want to save it now? ", 4 + 32 + 256, "Notice")
If Response = vbYes Then
Call btmSave_Click
DoCmd.Close
Forms("frmBB").Requery
Else
If Me.Dirty Then DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.Close
End If
End If
Exit_btmClose_Click:
Exit Sub
Err_btmClose_Click:
MsgBox Err.Description, vbInformation, SoftName
Resume Exit_btmClose_Click
End Sub
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|