VBA CODE

Dim SQLSTR As String
Dim rs As New ADODB.Recordset

rs.ActiveConnection = ADOCN
rs.CursorLocation = adUseClient
rs.LockType = adLockOptimistic

rs.Close
rs.Open (SQLSTR)
Public G_S_unpaid_id As Integer

Me.G_S_unpaid_id = Me.SH_unpaid_id

-- 另一个页面取值
Forms!F_未入金自動催促_対応コメント一覧.G_S_unpaid_id 
Dim CMD As New ADODB.Command
Dim SQLSTR As String

CMD.ActiveConnection = ADOCN
CMD.CommandType = adCmdText

CMD.CommandText = SQLSTR
CMD.Execute
PS_右クリックメニュー制御 Me
On Error GoTo エラー処理
GH_ADOERR = False

Exit Sub
エラー処理:
    If Err = 3709 Then
        ADO接続
        If GH_ADOERR = True Then
            Exit Sub
        Else
            Resume
        End If
    ElseIf Err = 3704 Then
        Resume Next
    Else
        MsgBox Err & Err.Description
    End If
DoCmd.OpenForm "F_未入金自動催促_対応コメント入力", , , , , , Me.edc_id
DoCmd.Close acForm, Me.Name
Me.H_idc_id = Me.OpenArgs
Form.Refresh
Form.Repaint
-- 获取焦点后调用方法刷新页面
Forms!F_未入金自動催促_対応コメント一覧.SetFocus
PS_F_未入金自動催促_対応コメント一覧_refresh

你可能感兴趣的:(VBA,VBA)