How do I concatenate a text field from a form to a "Where" string ?

  • Thread starter Thread starter mthornblad
  • Start date Start date
M

mthornblad

Hi

In the following, "id_Part" is a text field in a report.
Me.txtPart is a field on my input form.
strWhere is the condition for opening the report.

How do I concatenate the Me.txtPart so it is text (surrounded by
single quotes)
in the strWhere ?

In other words, I want the strWhere string to evaluate to the
following:

id_Part = '95405' (where 95405 is what is entered on the form)

Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#mm\/dd\/yyyy\#"

strReport = "Sales History Inquiry3"
strField = "is_Date"
strField2 = "id_Part"

If IsNull(Me.txtStartDate) And IsNull(Me.txtEndDate) Then
strWhere = strField2 & " = " & Me.txtPart
End If

I hope I made this clear.
Thanks in advance

Mark
 
Hi

In the following, "id_Part" is a text field in a report.
Me.txtPart is a field on my input form.
strWhere is the condition for opening the report.

How do I concatenate the Me.txtPart so it is text (surrounded by
single quotes)
in the strWhere ?

In other words, I want the strWhere string to evaluate to the
following:

id_Part = '95405' (where 95405 is what is entered on the form)

Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#mm\/dd\/yyyy\#"

strReport = "Sales History Inquiry3"
strField = "is_Date"
strField2 = "id_Part"

If IsNull(Me.txtStartDate) And IsNull(Me.txtEndDate) Then
strWhere = strField2 & " = " & Me.txtPart
End If

I hope I made this clear.
Thanks in advance

Mark

Oops ! Post to the wrong group. I reposted in forms... Sorry
Mark
 
Back
Top