Un-Updating a Form

Randomblink

The Irreverent Reverend
Local time
Today, 06:59
Joined
Jul 23, 2001
Messages
279
Ok, I have this database that is used to monitor and work with various projects that the City has...ie Convention Center Electrical Stuff, Parks & Recreation Roofing Stuff, etc...
Each project has an individual project number, engineer, etc...
I have built the tables, and forms for all of this...and it runs great...

BUT...
Now, we are trying to track invoices and similar documents...
So I have created a new table for them...
A form...
and the relationships so that the various invoices are related to the projects that they are for...
What I have now is, on the form that I use to input a new invoice, it has a search field - combo box and behind it are two unbound text fields...

When a user gets an invoice, they look up the project it is for, using the combo-box...
And when it is selected, the combo-box disappears and the two unbound text fields appear but now they contain the engineer's name for the project and the other one has the project number...

Let me explain why I do this in an unbound field...

1) I do not need the data stored in the invoices table since the invoice is related to the project and engineer already...
2) When the user finishes filling out the form, a report opens, fills out a routing slip based on data ON the OPEN form, two of those data's being the engineer name and the project number, and prints out a routing slip...

Now then, the problem I have is this...

If I have selected a project, and the combo-box has disappeared and the two unbound text boxes have appeared carrying the project engineers name and the project number, if I change my mind...and hit [ESC] to clear the record, I want the two unbound fields to disappear and the combo-box to reappear...

HOW DO I DO THIS...???
 
Hi Random,

you need to set the 'Key Preview' "event" of the form to Yes and then trap for the esc key eg
Code:
Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = 27 Then
        'do stuff with the boxes
    End If
End Sub

HTH

Drew
 
WOW!
Exactly as you said...
That is beautiful...
Thank you so very much...
I feel so enlightened now...lol
I have some serious books for visual basic coming in, I am hoping to be able to just KNOW this stuff soon...
But I have to say, that is the most BEAUTIFUL effect yet...(next to hiding your database in the system tray)...that I have seen...

THANK YOU THANK YOU Kind Sir...
 

Users who are viewing this thread

Back
Top Bottom