M
Musa via AccessMonster.com
Hello,
I would like to EXPORT data based on a query, however, the query has to be
capable of exporting in either case based on one variable "refused_tx" ( 1 =
true and 0= False).
My problem is trying to find a way to place this code in the query and have
it successfully export from this query (SEE Export Code Below). Perhaps SQL .
.?
The basic construct is this using : IF -THEN -ELSE statement
IF refused_tx = 1 THEN
current_living = IS NULL
issues = 0
services = 0
outcome = 0
fname = IS NULL
lname = IS NULL
complete_dt = IS NULL
ELSE IF
refused_tx = 0 THEN
current_living = IS NOT NULL
issues = 12
services = >0
outcome = >0
fname = IS NOT NULL
lname = IS NOT NULL
complete_dt = IS NOT NULL
END IF
Here is the EXPORT code:
Private Sub CMDexport_Click()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "Followupexp",
"C:\MYDATA" & Year(Date) & Format(Month(Date), "00") & Format(Day(Date), "00")
MsgBox ("You have sucessfully exported MY DATA to your C: Drive")
End Sub
Will this code work in SQL ? Or, does it need to be placed somewhere in the
VBA code ?
I didn't think SQL supported IF THEN ELSE statements in MS ACCESS.
I would like to EXPORT data based on a query, however, the query has to be
capable of exporting in either case based on one variable "refused_tx" ( 1 =
true and 0= False).
My problem is trying to find a way to place this code in the query and have
it successfully export from this query (SEE Export Code Below). Perhaps SQL .
.?
The basic construct is this using : IF -THEN -ELSE statement
IF refused_tx = 1 THEN
current_living = IS NULL
issues = 0
services = 0
outcome = 0
fname = IS NULL
lname = IS NULL
complete_dt = IS NULL
ELSE IF
refused_tx = 0 THEN
current_living = IS NOT NULL
issues = 12
services = >0
outcome = >0
fname = IS NOT NULL
lname = IS NOT NULL
complete_dt = IS NOT NULL
END IF
Here is the EXPORT code:
Private Sub CMDexport_Click()
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, "Followupexp",
"C:\MYDATA" & Year(Date) & Format(Month(Date), "00") & Format(Day(Date), "00")
MsgBox ("You have sucessfully exported MY DATA to your C: Drive")
End Sub
Will this code work in SQL ? Or, does it need to be placed somewhere in the
VBA code ?
I didn't think SQL supported IF THEN ELSE statements in MS ACCESS.