Forum Discussion

Tony2021's avatar
Tony2021
Steel Contributor
Jan 03, 2022

Open Report (strip out letters for Where clause)

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. 

 

  • Tony2021 


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

     

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

Resources