stuartkeith
Registered User.
- Local time
- Today, 19:43
- Joined
- Jan 5, 2007
- Messages
- 15
I am still having issues with getting a qbf working correctly! I have been told to use VBA to pass the criteria to the query? so far i have been trying this
But how do I pass this into a query. I tried doing this.
creating a module and global defining each varible that I want to use eg.
when the run query button is pressed, it then passes the value of the text boxes to each global value (eg server type is dell1850, so module1.criServertype now = dell1850)
fine.
I have then defined a function for eachtext box as well eg
the in the query critera cell enter
However it either runs but no results are displayed.
Get no function defined (then change to what form its on)
Get out of stack space.
I was ment to finish this last friday and this is all im stuck on!
Code:
Dim strCrit As String
If IsNull(Me.Server) Then
' proceed
Else
strCrit = strCrit & " And [Server type] = '" & Me.Server & "'"
End If
If IsNull(Me.Ram) Then
' proceed
Else
strCrit = strCrit & " And [Ram] = " & Me.Ram
End If
... etc
Select Case Me.OutputType
Case 1 ' report
DoCmd.OpenReport "YourReport", , , strCrit
Case 2 ' form
DoCmd.OpenForm "YourForm", , , strCrit
End Select
But how do I pass this into a query. I tried doing this.
creating a module and global defining each varible that I want to use eg.
Code:
Global criServertype as string
fine.
I have then defined a function for eachtext box as well eg
Code:
function funServertype()
funservertype=module1.criservertype
the in the query critera cell enter
Code:
=funServertype()
However it either runs but no results are displayed.
Get no function defined (then change to what form its on)
Get out of stack space.
I was ment to finish this last friday and this is all im stuck on!