'form code '这样即使父窗体多开也没关系,如果用一个全局变量会串数据 private s_ReturnValue as stringpublic sub Set_Value(s_Value) s_ReturnValue = s_Value end subpublic function Read_Value() as string Read_Value = s_ReturnValue end function
加上 acDialog 参数就可以了 Private Sub Command0_Click() On Error GoTo Err_Command0_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "frmInput" DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog MsgBox "窗体关闭" Exit_Command0_Click: Exit SubErr_Command0_Click: MsgBox Err.Description Resume Exit_Command0_Click End Sub
设置一个全局变量,在窗体中点击确定时设置一下值就可以了。
这是VB6的代码么?我是在ACCESS里用VBA编程。frn是form类型的对象变量么?
'form code
'这样即使父窗体多开也没关系,如果用一个全局变量会串数据
private s_ReturnValue as stringpublic sub Set_Value(s_Value)
s_ReturnValue = s_Value
end subpublic function Read_Value() as string
Read_Value = s_ReturnValue
end function
谢谢。我需要在inputbox里加个datetimepicker控件,供用户输入。
Me.Caption = "2133"
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click Dim stDocName As String
Dim stLinkCriteria As String stDocName = "frmInput"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog MsgBox "窗体关闭"
Exit_Command0_Click:
Exit SubErr_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
End Sub