将表单宏转换为 Visual Basic。现在,我选择下一条和上一条记录的命令按钮位于 vba 代码中。Next 获取要更新的文本框的代码并将其放在选择记录的行下。
'------------------------------------------------------------
' Command24_Click
'
'------------------------------------------------------------
Private Sub Command24_Click()
On Error GoTo Command24_Click_Err
On Error Resume Next
DoCmd.GoToRecord , "", acPrevious
Me.Parent!ContactInformation.Form!ContactInformation_Address.Value = Text0.Value
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
Command24_Click_Exit:
Exit Sub
Command24_Click_Err:
MsgBox Error$
Resume Command24_Click_Exit
End Sub
'------------------------------------------------------------
' Command25_Click
'
'------------------------------------------------------------
Private Sub Command25_Click()
On Error GoTo Command25_Click_Err
' _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
' <UserInterfaceMacro For="Command24" xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application"><Statements><Action Name="OnError"/><Action Name="GoToRecord"><Argument Name
' _AXL:="Record">Previous</Argument></Action><ConditionalBlock><If><Condition>[MacroError]<>0</Condition><Statements><Action Name="MessageBox"><Argument Name="Message">=[MacroError].[Description]</Argument></Action></Statements></If></ConditionalBlo
' _AXL:ck></Statements></UserInterfaceMacro>
On Error Resume Next
DoCmd.GoToRecord , "", acNext
Me.Parent!ContactInformation.Form!ContactInformation_Address.Value = Text0.Value
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
Command25_Click_Exit:
Exit Sub
Command25_Click_Err:
MsgBox Error$
Resume Command25_Click_Exit
End Sub