Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB field value transfer?

Status
Not open for further replies.

ffleitas

Technical User
Mar 15, 2001
85
US
Hello,


How can I get the propertyid to equal 1 & 2 & 3 if the propertyid selected from the form = 12? I have the code below placed in the form which is transfered over to the report.




On Error GoTo Err_Preview_Click


Dim strWhereProperty As String

strWhereProperty = "PropertyID = Forms![frmPropertySelection]!SelectProperty"

Select Case Me!ReportToPrint
Case 1
DoCmd.OpenReport "rptTicket", PrintMode
Case 2
'DoCmd.OpenReport "rptTicket", PrintMode, , strWhereProperty
Case 3
If IsNull(Forms![frmPropertySelection]!SelectProperty) Then
DoCmd.OpenReport "rptTicket", PrintMode
Else
DoCmd.OpenReport "rptTicket", PrintMode, , strWhereProperty

End If
End Select

DoCmd.Close acForm, "frmPropertySelection"

Exit_Preview_Click:
Exit Sub

Err_Preview_Click:
Resume Exit_Preview_Click
 
strWhereProperty = "PropertyID = " & Forms![frmPropertySelection]!SelectProperty


 
Great it transferred over.

How do I get the propertyid to = 1 & 2 & 3 on the report now that propertyid = 12? In other words I only want the values of the propertyid field of 1 & 2 & 3 to show on the report since the value of 12 was transferred.

Thanks.
 
I don't understand your question. What do you mean "get the propertyid to = 1 & 2 & 3"? Do you want it to become 123? Why are you concatanating the three numbers together?

If PropertyId on the form, i.e. can you do this:

Me.PropertyID = 123


 
What I would like is for the propertyid to equal 1 also 2 and also 3 so the report will only print those propertyid's instead of 4, 5, 6, etc.

I hope and a bit clearer now?

Thanks.
 
If the PropertyID field is numeric and you enter values into the control with commas between, you should be able to use:
Code:
strWhereProperty = "PropertyID IN (" & _
    Forms![frmPropertySelection]!SelectProperty & ")"

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top