TimE
04-08-2007, 04:15 PM
1) I would like to pass the value of an inputbox to a sql statment:
2) The "If IsNull(stAuthDocIn) Then" is not working, how should it be done?
Private Sub AuthDocIn()
Dim stAuthDocIn
stAuthDocIn = InputBox("Please enter the authorizing document #.", "AUTHORIZING DOCUMENT")
If IsNull(stAuthDocIn) Then
MsgBox "You MUST enter the authorizing document!", vbOKOnly + vbCritical, "Authorizing Document!"
End If
End Sub
Here is the piece I use to add it to a table. I want to pass the value of the Inputbox to the value of a field. When it runs this piece, it brings up another msgbox asking for the value of stAuthDocIn.
DoCmd.RunSQL "INSERT INTO tblDCscan([AUTH_DOC_IN], [ASSET_TAG], [SERIAL_NUM], [MAKE], [MODEL], [DESCRIPTION], [CATEGORYCODE], [RETIRE_DATE]) " & _
"VALUES (stAuthDocIn, '" & Me![SelectionList].Column(0) & "', '" & Me![SelectionList].Column(1) & "','" & Me![SelectionList].Column(3) & "', '" & Me![SelectionList].Column(4) & "','" & Me![SelectionList].Column(5) & "', '" & Me![SelectionList].Column(6) & "', '" & Me![SelectionList].Column(7) & "')"
Stumped!!!
2) The "If IsNull(stAuthDocIn) Then" is not working, how should it be done?
Private Sub AuthDocIn()
Dim stAuthDocIn
stAuthDocIn = InputBox("Please enter the authorizing document #.", "AUTHORIZING DOCUMENT")
If IsNull(stAuthDocIn) Then
MsgBox "You MUST enter the authorizing document!", vbOKOnly + vbCritical, "Authorizing Document!"
End If
End Sub
Here is the piece I use to add it to a table. I want to pass the value of the Inputbox to the value of a field. When it runs this piece, it brings up another msgbox asking for the value of stAuthDocIn.
DoCmd.RunSQL "INSERT INTO tblDCscan([AUTH_DOC_IN], [ASSET_TAG], [SERIAL_NUM], [MAKE], [MODEL], [DESCRIPTION], [CATEGORYCODE], [RETIRE_DATE]) " & _
"VALUES (stAuthDocIn, '" & Me![SelectionList].Column(0) & "', '" & Me![SelectionList].Column(1) & "','" & Me![SelectionList].Column(3) & "', '" & Me![SelectionList].Column(4) & "','" & Me![SelectionList].Column(5) & "', '" & Me![SelectionList].Column(6) & "', '" & Me![SelectionList].Column(7) & "')"
Stumped!!!