Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Sub BuildQuery_Click()
On Error GoTo Err_BuildQuery_Click
Dim stDocName As String
Dim Tmpqry As QueryDef
Dim db As Database
Dim InList As String
Dim qryName As String
Set db = CodeDb()
qryName = "zQry" & Me.Name
stDocName = "SELECT TxnPerfPhysician, AccountNumber,"
stDocName = stDocName & " Name, PtStatus, TxnSerDate "
stDocName = stDocName & " From TSG_PatientInformation"
stDocName = stDocName & " ORDER BY TxnSerDate;"
On Error Resume Next
Set Tmpqry = db.CreateQueryDef(qryName, stDocName)
Select Case Err.Number
Case 0
Case 3012 ' The query already existed but this will overwrite.
Set Tmpqry = db.QueryDefs(qryName)
Tmpqry.SQL = stDocName
Case Else
GoTo Err_BuildQuery_Click
End Select
On Error GoTo Err_BuildQuery_Click
DoCmd.OpenQuery qryName, acViewNormal, acEdit
Exit_BuildQuery_Click:
Exit Sub
Err_BuildQuery_Click:
MsgBox Err.Description
Resume Exit_BuildQuery_Click
End Sub