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!

CHECKING FOR LAST DATE WORK DONE ON 1

Status
Not open for further replies.

ve7epq

Technical User
Dec 17, 2003
25
CA
Hi All. Best of the Season. I am working on a database for our WORK ORDER system. We have units come in randomly every 3 or 4 months. I have a field for todays date and for last_date. What I am trying to do...and logic defys me...is the following:

Serial_Number_AfterUpdate
once the s/n is input I need to check the [TYPE] and [Serial_NUMBER] of the current work order against my existing data in my query [qrySEARCH] If I find the match then I need to return the date from the previous work order to the open form. If not...I will return "Date" as the date of the last calibration/repair.

Help would be greatly appreciated
 
Mike,

The code that I wrote shouldn't change the data in "Date". It should only show the highest date of all records that was found to meet the search criteria.

If no record was found then it should set Last_Date as today's date.

The only thing that I can think of for your issue is that your form is not an add new record only form. I'm assuming that this form must show all records from the WorkOrders table.

If so all you'll need to do as add in an if then else statement at the beginning to check and see if this is a new record.
 
Excellent. Will do. Now (hopefully) only one more question. On both the main database and the backup I have now lost ALL of the startup forms. By that I mean....when you start a new database you have a box on screen that allows you to create using....forms reports tables querys. It vanished. Now the only way I can get into the form I have created is to either make it the startup option or go via Visual Basic. It happened when I was using my mouse to move across the screen. Is this a known bug in Access 2000?

Is there a way to force the screen back to normal. I have compacted the database. And I have DAO set to 3.6

Mike
 
I'm not sure exactly how your form is set up so its hard for me to explain exactly what to do.

If you would like to only have the LAST_DATE to run only on a new record then add this to the beginning of the code.

if me.newrecord = true then

At the bottom of the code after the lines

me.date = strdate ' sets the date as the higest/last date in the record that matched the criteria.
end if

add in

else
end if




Currently seeking for position around Boston, MA. kenphu@yahoo.com
 
So what your saying is that when you open up your database. You don't have the design screen that allows you to add/edit tables, queries, forms etc.

Do you have a main menu form that automatically executes on open?

If so then close down your db and as you open the db hold down the "shift" key.
 
Ended up having to go back to a back up from last week of the database that I am working on. It was corrupted. The <SHIFT> did nothing. It was really wierd!

I am going to change the variable DATE that I am using on my form, because it is getting too confusing as to where I am looking at me.date or I am setting something to Date which is a reserved word.......that is something I learned about this process. I am going to rename all occurrances of the field DATE in my tables and forms to woDate and see if that helps


Mike
 
yeah, I find that is one flaw about access. It gets corrupted a little too easy.

let me know how you make out.

ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top