Need to clear SOME fields in a form

cinders

Registered User.
Local time
Today, 15:01
Joined
Aug 28, 2001
Messages
48
Hello Everyone,

I have a main form for entering transactions. There are 2 fields which are transaction X of Y (X being one field, Y being the other so for example TRANSACTION "1" or "2")

If Y is greater than 1, when the user finishes inputting all information on the subsequent forms and completes the first transaction, I want them to come back to the initial form and have all their personal data still displaying, but the info specific to the first transaction cleared out and ready for input for the details of transaction number 2. How can I set certain fields of a form to be blank when that form gains focus.

I know there may be many other ways to do this, form and subform for example, but I am replicating an existing system for training purposes that behaves this way.

I've tried setting the field values to = "", but it does not work as the debugger tells me that I cannot set the value to "" unless the field has the focus, my problem is I have 3 fields I need to set to null and they all cannot have the focus at the same time.

Any suggestions would be greatly appreciated.

Thanks

Cindy
 
If you're getting the focus error, you're probably using the .Text property of the controls, like:

Me.ControlName.Text = ""

If so, just drop the .Text:

Me.ControlName = ""

The default is .Value, which is what you want anyway, and it doesn't require focus.
 
Now you can do this a couple of ways. First in the data objects GotFocus event put this:
If Me.NewRecord Then
Me!Your Name= Null
End If
This way it won't make existing records Null unless you change it. Also in the forms On Open event you use this:
If Me.NewRecord Then
Me!Your Name1= Null
Me!Your Name2= Null
Me!Your Name3= Null
End If
Again this will only effect the data objects if they are newrecords. hth.
 
Thanks for your help.

I've got it working now.

:)
 

Users who are viewing this thread

Back
Top Bottom