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

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
 
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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top