Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding a date in a table

Status
Not open for further replies.

04061975

Programmer
Mar 19, 2003
8
AU
I have a table that contains a field "Date" the format for this field is dd/mm/yyyy ie 01/01/2003. From this table I would like to get the all the dates that fall between 01/01/2003 and 31/01/2003. I have started with a form that has a combo box on it for the start date. I currently have the user select the require date form the list. From there I have started to code an event procedure that looks like this.

Private Sub Cbo_FindDate_BeforeUpdate(Cancel As Integer)

Dim strWhere As String

strWhere = "Format(MyreGracePA.Date, 'ddmmyyyy')= '" & Format(Cbo_FindDate, "ddmmyyyy") & "'"
MsgBox DLookup("Date", "FindMonth_tbl", strWhere)

If ((DLookup(&quot;Date&quot;, &quot;FindMonth_tbl&quot;, strWhere))) <> 1 Then
Cancel = True
End If

End Sub

But some where a long the line I have missed some thing because I am getting an error any ideas as to where I should be look at in order to fix the error or am I off track with this idea. Any thoughts would be greatly appreciated.

Kind Regards Nicolle
 
maybe you can use query instead..user just have to put the specific date they needed..
try this in your query
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top