access vba - manipulating variable and retrieving report -


i'm trying work out problem , need help. have 3 types of users (t8xxxxx, p9xxxxx , xxxxx) each of these users have different elements , such has different report. top 2 if statements work, far opening reports, 1 report blank , third fails together. i'm not sure how solve this, , hoping professionals. appreciated!

private sub cmdprintindrep_click() dim struser string struser = forms.frmsupresults.subfrmusrres!username         if left(struser, 2) "t8"             docmd.openreport "fedinvest - issr recertification report", acviewpreview             elseif left(struser, 2) "p9"                 docmd.openreport "courts - issr recertification report", acviewpreview             else left(struser, 2) not "p9" , not "t8""                 docmd.openreport "fedinvest - issr internal users recertification report", acviewpreview end if end sub 

disclaimer: i'm no professional can help.

i adjusted definition of struser using reference referring controls found here.

assuming there 3 types of users, removed last if statement. if not 1st type, nor 2nd type, must 3rd type of user.

lastly, should use = instead of like in conditions if statements.

private sub cmdprintindrep_click()  dim struser string struser = forms!frmsupresults!subfrmusrres.form!username      if left(struser, 2) = "t8" or left(struser, 2) = "t8"         docmd.openreport "fedinvest - issr recertification report", acviewpreview     elseif left(struser, 2) = "p9" or left(struser, 2) = "p9"         docmd.openreport "courts - issr recertification report", acviewpreview     else         docmd.openreport "fedinvest - issr internal users recertification report", _                           acviewpreview     end if end sub 

as far reports being blank, record source?


Comments