ok don't know what I would do without this forum.....Being a newbie I seem to get stuck and research and still don't understand sometimes what is going on. It probably would help if I knew some debugging tools and took a VB course. But here is my problem. I have a table and I am adding a spoilage/variance record for ending Physical Inventory. The person entering the ending Physical Inventory needs to enter the physical inventory with the last working day of the end of the month it was taken in. So I am trying to do some validity checks when they are entering the date. To do this I need to break apart using Datepart the day, month, year for comparison. But I also need to break apart the date of the last day that was entered into the table. So I set my recordset to my table and order it by the used_date. I then try to move to the last record and break apart the last used_date. I keep getting a Null value for my date field. I threw in a moveprevious to see if I was hitting the EOF which I realize I still need to error trap that....but first I can't figure out why movelast is null. This is being entered through a form...so i figured I maybe at a new record that has not been added yet...thus throwing in the moveprevious to go one record back. But it is still a null value. Here is what I have coded. Not sure if I need to build a loop and go through the loop to hit the EOF. Help please.
Dim m1, y1, m2, y2 As String
Dim t1 As String
Dim db As Database
Dim rst As Recordset
Dim LResponse As Integer
Set db = CurrentDb()
Set rst = db.OpenRecordset("Select * From [Stamp Inventory] Order by Used_Date")
rst.MoveLast
rst.MovePrevious
d1 = DatePart("d", Me.Used_date)
m1 = DatePart("m", Me.Used_date)
y1 = DatePart("yyyy", Me.Used_date)
d2 = DatePart("d", Date)
m2 = DatePart("m", Date)
y2 = DatePart("yyyy", Date)