I wish to open an Access report which should read a value from the vb form. The access report should pick up the Hospital# from a textbox and only one record should be opened. Here is my code:
Private Sub cmdCallLog_Click()
Dim strWhere As String
strWhere = "'" & txtHospID.Text & "'"
Set mAcc = New Access.Application
mAcc.OpenCurrentDatabase "............mdb"
mAcc.DoCmd.OpenReport "CTX_HDCALLS_rpt", acViewPreview, , strWhere
mAcc.Visible = True
End Sub
My problem is a popup window opens and request for Hospital# when I set up the criteria in the access report. ["Enter hospital Number"]. I do not wish this to happen. The report should be able to read Hospital# from the variable strwhere. Where am I going wrong? Any help appreciated.