A
anil
hi all
I have 2 tables tblnewone and tbllog.I am changing data every week in
tblnewone and keeping the log in tbllog.What I am trying to do is to
compare the dates in two table and run the procedure.I am Appending the
table tbllog and ADate is in ascending order.Some times it works well
but some times do not.Can u please tell me the error,where I am
wrong.Here I am only trying to compare for last day,but actually I need
to Compare date in tbllog for last week or for fixed one day say monday
or friday.Can u help me to change that.
thanks
anil
Private Sub Command0_Click()
Dim str As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblLog")
rst.MoveLast
If DMax("ADate", "tblLog") <> DMax("Bdate", "tblnewone") Then
Call newtblnsites 'call another procedure
str = "INSERT INTO tblLog ( SiteCode, [ADate],SiteAddress)"
& _
"SELECT tblnewone.SiteCode, Now() AS
[ADate],SiteAddress " & _
"FROM tblnewone;"
DoCmd.RunSQL str
Else
MsgBox ("You already have generated the table")
Exit Sub
End If
Set db = Nothing
Set rst = Nothing
End Sub
I have 2 tables tblnewone and tbllog.I am changing data every week in
tblnewone and keeping the log in tbllog.What I am trying to do is to
compare the dates in two table and run the procedure.I am Appending the
table tbllog and ADate is in ascending order.Some times it works well
but some times do not.Can u please tell me the error,where I am
wrong.Here I am only trying to compare for last day,but actually I need
to Compare date in tbllog for last week or for fixed one day say monday
or friday.Can u help me to change that.
thanks
anil
Private Sub Command0_Click()
Dim str As String
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("tblLog")
rst.MoveLast
If DMax("ADate", "tblLog") <> DMax("Bdate", "tblnewone") Then
Call newtblnsites 'call another procedure
str = "INSERT INTO tblLog ( SiteCode, [ADate],SiteAddress)"
& _
"SELECT tblnewone.SiteCode, Now() AS
[ADate],SiteAddress " & _
"FROM tblnewone;"
DoCmd.RunSQL str
Else
MsgBox ("You already have generated the table")
Exit Sub
End If
Set db = Nothing
Set rst = Nothing
End Sub