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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Function

Status
Not open for further replies.

HGoodloe

Programmer
Sep 4, 2008
53
US
Hello once again, this is pretty much the same as what I sent last week in regards to searching a record(s) by date. I just realized that I failed to mention that the dates in which I was trying to use as a search are supposed to be Start Date and End Date as oppose to a single date.

The code that you provided did work for a single date setup, but it is actually needed for both Start and End Date

I did try unsuccessfully to manipulate the code you provided for the single date search, but no luck. So, here I am again.

So, the following is what I need for the Start and End Date set up. I have two text boxes on my form one for Start Date the other for end date. Can someone help me out with this. I'm kinda new at this so please excuse me for not being specific when I sent the request last week. THANKS.

I'm working on a monthly records prepping database that has date_prepped as one of the fields in the table. Dates for the current month, previous months and previoius year(s) are already in the table.

I need to do a record search by specific dates that already exist in the table.

If that particular date is not in the database or table, a message box should appear indicating that an incorrect date has been entered. I was trying do this using VBA code, unless there's a more easier efficient way of going aboutit.

This would probably be the equivalent of trying to search for a social security number that isn't in the database. If it's not in the database, then an error message would be prompt.
 

Something like this?
Code:
If IsNull(DLookup("DateField","yourTable","DateField = #" & Me.StartDate & "#")) Then
   Msgbox "The date you entered is not valid.", vbOKOnly, "Start Date Not Found"
Else
   [i]What do you want to do if it's found?[/i]
End If


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top