M
Michael Hinde
Can anyone please tell me how to place the result of an
Input Box into a query (as a selection parameter)?
I have the following code set up to check that the
information (ATM Prefix) entered by the user does exist
within the database but am at a loss as to how I can then
run a query without the user having to input the prefix
again. (obviously making the whole code redundant!)
Any help much appreciated.
Michael
*************************************************
Public Sub Box11_Click()
On Error GoTo Err_Box11_Click
Dim db As Database
Dim rec As Recordset
Dim strSQL As String
Dim strSQL2 As String
Dim strAns As String
strAns = InputBox("Please enter the ATM
Prefix... ", "Single Prefix Report")
If strAns <> "" Then
Set db = CurrentDb()
strSQL = "select * from tblAtmDetails where
ATM_Prefix = '" & strAns & "'"
Set rec = db.OpenRecordset(strSQL)
If rec.RecordCount = 0 Then
MsgBox "This ATM Prefix has no available
contribution stats"
rec.Close
Else
' Feed [strAns] into a (large) query
' Run the query/report now
End If
End If
Input Box into a query (as a selection parameter)?
I have the following code set up to check that the
information (ATM Prefix) entered by the user does exist
within the database but am at a loss as to how I can then
run a query without the user having to input the prefix
again. (obviously making the whole code redundant!)
Any help much appreciated.
Michael
*************************************************
Public Sub Box11_Click()
On Error GoTo Err_Box11_Click
Dim db As Database
Dim rec As Recordset
Dim strSQL As String
Dim strSQL2 As String
Dim strAns As String
strAns = InputBox("Please enter the ATM
Prefix... ", "Single Prefix Report")
If strAns <> "" Then
Set db = CurrentDb()
strSQL = "select * from tblAtmDetails where
ATM_Prefix = '" & strAns & "'"
Set rec = db.OpenRecordset(strSQL)
If rec.RecordCount = 0 Then
MsgBox "This ATM Prefix has no available
contribution stats"
rec.Close
Else
' Feed [strAns] into a (large) query
' Run the query/report now
End If
End If