SOLVED

Open Report (strip out letters for Where clause)

Steel Contributor

Hello Experts,

 

I have the following OpenReport code: 

DoCmd.OpenReport "rptPC", acViewReport, , "[DDNo]= " & Me.txtDrawNo

I need to modify it since [DDNo] is not a number...it's text.

There is another issue I need to take into account. 

 

the [DDNo] has 2 letters appended to the front like this:

DD1

DD2

DD3...

I need to somehow ignore the DD part of the DDNo

The Me.txtDrawNo is a number and doesnt have the "DD" part appended.

if I can strip out the "DD" part of [DDNo] then I will be able to open the report. 

 

How could the above DoCmd be modified to strip out the "DD" part of [DDNo]? 

I hope that makes sense.  Let me know if any questions. 

 

thank you. 

 

4 Replies
best response confirmed by Tony2021 (Steel Contributor)
Solution

@Tony2021 


Try this and let us know if it is successful or not.

 

DoCmd.OpenReport "rptPC", acViewReport, , "[DDNo]= """ & Replace(Me.txtDrawNo, "DD","") & """"

Hi,

 

DoCmd.OpenReport "rptPC", acViewReport, , "DDNo='DD" & Me!txtDrawNo & "'"

 

Servus
Karl
************
Access News
Access DevCon

perfect. thank you very much.
Hi Karl, this works too....
1 best response

Accepted Solutions
best response confirmed by Tony2021 (Steel Contributor)
Solution

@Tony2021 


Try this and let us know if it is successful or not.

 

DoCmd.OpenReport "rptPC", acViewReport, , "[DDNo]= """ & Replace(Me.txtDrawNo, "DD","") & """"

View solution in original post