E
esi
Having trouble with the coding in this form. I keep getting errors with the
sql for "expected end of statment"
Private Sub Command8_Click()
Dim dbs As Database
Dim qdf As QueryDef
Dim strsql As String
Dim mytable As String
Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("WeekBadClaimqry")
mytable = [List4]
strsql = "SELECT [Plan], [Patient_Name], [Rx#], [Fill_Date], [NDC],
[Drug_Name], [B_G], " _
& "EXTRACT_FILE.Basis, [AWP], [Cost], [Price], [Margin],
1-([Price]/[AWP]) AS Expr1 " _
& "FROM [" & mytable & "] LEFT JOIN EXTRACT_FILE ON [NDC] =
EXTRACT_FILE.NDC " _
& "WHERE [Plan]="EXR" " _
& "ORDER BY [B_G], [Margin], 1-([Price]/[AWP])"
qdf.SQL = strsql
Set qdf = Nothing
DoCmd.OpenQuery "WeekBadClaimqry"
End Sub
sql for "expected end of statment"
Private Sub Command8_Click()
Dim dbs As Database
Dim qdf As QueryDef
Dim strsql As String
Dim mytable As String
Set dbs = CurrentDb
Set qdf = dbs.QueryDefs("WeekBadClaimqry")
mytable = [List4]
strsql = "SELECT [Plan], [Patient_Name], [Rx#], [Fill_Date], [NDC],
[Drug_Name], [B_G], " _
& "EXTRACT_FILE.Basis, [AWP], [Cost], [Price], [Margin],
1-([Price]/[AWP]) AS Expr1 " _
& "FROM [" & mytable & "] LEFT JOIN EXTRACT_FILE ON [NDC] =
EXTRACT_FILE.NDC " _
& "WHERE [Plan]="EXR" " _
& "ORDER BY [B_G], [Margin], 1-([Price]/[AWP])"
qdf.SQL = strsql
Set qdf = Nothing
DoCmd.OpenQuery "WeekBadClaimqry"
End Sub