Criteria in VBA for report-query

pacg

Registered User.
Local time
Today, 15:29
Joined
Aug 27, 2004
Messages
25
Hi

I have a textbox (C4) has to be a criteria in the report "RELAT_GENERICO".
The field in the report is numeric, so he receives 1 or 2 or 3 ...

I need to "pass" my string ("19 or 20 or 21") to be the criteria but she passes like string or like a complex string.

How to do it?

CODE
Dim QUOTE As Variant
Dim stDocName As String
Dim i As Integer
Dim where, C10 As String
Dim c11 As Variant

QUOTE = ""

where = "=18"

If IsNull(C4a) Then
'This is for no-choice. To be all the records!!

For i = 19 To 20

where = where & " ou =" & i

Next i

C4.Value = QUOTE & where & QUOTE
MsgBox (C4)

Else

C4 = C4a

End If

stDocName = "RELAT_GENERICO"
DoCmd.OpenReport stDocName, acPreview


Thanks
 
Dim stLinkCriteria As String
stLinkCriteria = "[YourField] = " & C4a
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
 
RG

Did you undestand?
1st. I have more than one field.
2nd. I probably have more than one parameter = 1 or 2 or 3 ... so stLinkCriteria = "[YourField] = " & C4a its IMPOSSIBLE!

The picture:
one form - has 5 textboxes (c1,c2,...c4...)
one report with a query source - 5 fields, each one with the criteria set to Forms![my form]![c1],...[c4]...
one action - create a generic report with 5 options, if i can say this! But i have a problem: when one of textboxes is empty so, i need to determine a no-criteria or to put all the possible options.

Thanks nevertheless
 

Users who are viewing this thread

Back
Top Bottom