12-03-2011, 00:38
|
|
|
|
חבר מתאריך: 16.11.06
הודעות: 216
|
|
עזרה ב-Date Range עם VBA Access
שלום..
יש לי העיה עם קוד ב VBA שאמור לבצע סינון של טווח תאריכים
בגדול יש לי טופס (Form) עם שתי תיבות טקסט - תאריך התחלה ותאריך סיום.
קוד:
Private Sub ClickRange_Click()
Dim sql As String, intX As Date, intY As Date
Dim qdfLoop As QueryDef, Qry As QueryDef
For Each qdfLoop In CurrentDb.QueryDefs
If qdfLoop.Name = "Que" Then DoCmd.DeleteObject acQuery, "Que"
Next qdfLoop
'''txtStartDate.Value = 0 Then Exit Sub
If txtStartDate.Value = 0 Then MsgBox ("Set Start Date")
intX = txtStartDate.Value
intY = txtEndDate.Value
sql = "SELECT credit.order, credit.Date FROM credit WHERE (((credit.Date) Between #" & intX & "# And #" & intY & "#));"
Set Qry = CurrentDb.CreateQueryDef("Que", sql)
DoCmd.OpenQuery "Que"
End Sub
לחיצה על הכפתור עם הקוד הנ"ל אינה מניבה תוצאות נכונות
לא הצלחתי למצוא את הטעות שלי
אשמח לעזרה
תודה
_____________________________________
|