criteria used in report label (little diff from other posts on this)

  • Thread starter Thread starter _Bigred
  • Start date Start date
B

_Bigred

Hello Guys,

(Office XP - Access)

I used the allen browne method for getting the criteria pasted to the report
header label.

I created a text box in the header with "=PresetNAME"

However here is the problem....

My report is based on a query that prompts me to enter a PresetName aka name
of a guitar patch
could be Metallica or Metallica-One or Pink Floyd or Pink Floyd - Money
Is there a way for me to limit the data sent to the text box in the header,
to only take everything before the first space in the PresetName or
everything before a hyphen???

TIA,
_Bigred
 
Hi BigRed,

It would be best to build a filter string for the report (as
opposed to imbedding a parameter in a query)--in this way,
you can use comboboxes and listboxes to make it easier for
the user to choose criteria and you can ignore criteria when
it has not been specified...

In your case, you are just requesting one piece of
information (or that is all you mentioned anyway) -- PresetName

create a form

name it ReportMenu

create a combobox to pick the PresetName

name it PresetName

create a command button and, on the [Event Prcedure] for the
Click event...

-----------------------
'tell Access you are going to create a variable to hold text
dim mFilter as string

'initialize the variable
mFilter = ""

'test the PresetName control to see if it is filled out
'if it is, we are going to make mFilter hold the criteria
If not IsNull(me.PresetName) Then
mfilter = "[PresetName_Fieldname]= '" & me.PresetName
& "'"
end if

if len(mfilter) > 0 then
DoCmd.OpenReport "ReportName", acViewPreview, , mfilter
else
DoCmd.OpenReport "ReportName", acViewPreview
endif
---------------------------

then, on your report, since the form is open and PresetName
may be filled out, use this for the ControlSource

--> =nz(forms!ReportMenu!PresetName)


Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access

(e-mail address removed)
 
Back
Top