B
Becky Isserman
Let me explain what I am trying to do. I want a dlookup to find all
the fdids that did not report 3 months back when someone pushes a
button. Then I want those fdids to be used to insert a record into the
"Logs" table with "Not Reporting", Month(Not Reported), Year(Not
Reported), and Letter Submitted (Checked). Then I want a report to
open up that will send a letter to everyone not reporting. I have very
few hours left at this client and would like to get it done asap.
Here is my code:
Private Sub Command33_Click()
Dim FDID As String
FDID = (DLookup("[FDID]", "Logged", "Report Year = Year(Date()-92)" And
"Month = MonthName(Month(Date()-92))"))
DoCMD.RunSQL "INSERT INTO Logged ( FDID, [Report Year], [Month], [Type
of Media], [Letter Sent] )
SELECT Logged.FDID, Logged.[Report Year], Logged.Month, Logged.[Type of
Media], Logged.[Letter Sent]
FROM Logged
WHERE (((Logged.FDID)="FDID") AND ((Logged.[Report
Year])<Year(Date()-92)) AND ((Logged.Month)<Month(Date()-92)) AND
((Logged.[Letter Sent])=Yes))";
DoCmd.OpenReport "Delinquent Letter"
End Sub
It is giving me an error in the first statement related to the Report
Year and the Month. It says that they are incorrect type I believe. The
Report Year and Month are text fields. I need to do a dlookup of all
fdids that did not report 3 months ago when someone pushes a button. I
am not exactly sure what the correct syntax is.
Also, the insert function will not work it is throwing off a 3134 run
time error, which I googled and looked on technet for and could not
find answers. Any help would be appreciated at
(e-mail address removed) or MSN as (e-mail address removed).
Reply With Quote
the fdids that did not report 3 months back when someone pushes a
button. Then I want those fdids to be used to insert a record into the
"Logs" table with "Not Reporting", Month(Not Reported), Year(Not
Reported), and Letter Submitted (Checked). Then I want a report to
open up that will send a letter to everyone not reporting. I have very
few hours left at this client and would like to get it done asap.
Here is my code:
Private Sub Command33_Click()
Dim FDID As String
FDID = (DLookup("[FDID]", "Logged", "Report Year = Year(Date()-92)" And
"Month = MonthName(Month(Date()-92))"))
DoCMD.RunSQL "INSERT INTO Logged ( FDID, [Report Year], [Month], [Type
of Media], [Letter Sent] )
SELECT Logged.FDID, Logged.[Report Year], Logged.Month, Logged.[Type of
Media], Logged.[Letter Sent]
FROM Logged
WHERE (((Logged.FDID)="FDID") AND ((Logged.[Report
Year])<Year(Date()-92)) AND ((Logged.Month)<Month(Date()-92)) AND
((Logged.[Letter Sent])=Yes))";
DoCmd.OpenReport "Delinquent Letter"
End Sub
It is giving me an error in the first statement related to the Report
Year and the Month. It says that they are incorrect type I believe. The
Report Year and Month are text fields. I need to do a dlookup of all
fdids that did not report 3 months ago when someone pushes a button. I
am not exactly sure what the correct syntax is.
Also, the insert function will not work it is throwing off a 3134 run
time error, which I googled and looked on technet for and could not
find answers. Any help would be appreciated at
(e-mail address removed) or MSN as (e-mail address removed).
Reply With Quote