Clearing Forms Details.

truediamond

New member
Local time
Today, 09:49
Joined
Jan 23, 2007
Messages
6
Hi,

I have a form that is used to record new information. Behind the form is a VB module that dpes validation on the fields and on succesful validation closes the form down.

This all works well, but on re-entering the form, the data from the previous entry remains in the fields.

Can anyone suggest how I can clear the form, and why the closing of the form does not clear the cache?
I have tried both
DoCmd.Close acForm, "[Add New Membership Details]", acSaveNo and
DoCmd.RunCommand acSaveNo to close the form, but neither makes any difference.

Regards
TD
 
is the form bound to a table?

Peter
 
If you only use the form to add new entries then you can set it so it always shows an empty one.

On the form designer, get the properties for your form, go to the data tab (2nd tab) and there should be an option Data input or somesuch (i'm using a dutch version so i'm not sure anymore what it's called in the english version), it's the 4th from the bottom for me. Just set that one to "yes" and the form will always start in "new record" mode.

It will not, however, list any more data from the table or query you bound your form to. Maybe you can do it so it does, but i haven't tried that yet ;)
 
Not Really peter...
It was originally when I first constructed it, but I removed any links to a table and replaced them with direct code to add new records when the validation was succesful.

Does this make a difference? The reason I am asking is that when I have a form bound to a table, then there never was an issue with the form opening up in a new record. (as per JP-C's comment above).

TD
 
I have not had issues with unbound forms retaining data. So just some quick Ideas :)

Are you setting any default values in the form?
Does it still retain if you close it manualy?
does the form really close or is subsequent code just hidding it?

Peter
 
Bat17 said:
I have not had issues with unbound forms retaining data. So just some quick Ideas :)

Are you setting any default values in the form?
Does it still retain if you close it manualy?
does the form really close or is subsequent code just hidding it?

Peter

1. I was setting default values in some fields, but its all the fields that are retaining their values!!
2. If i close manually it still retains!
3. Pretty sure the form is closed.. well I can't see it hanging about anywhere!!

I have manged to workaround it, by setting all the fields to null in the code once I have done the myset.update command.
Tested it aand it seems to work well.

If you have any other flashes of inspiration then let me know, but i'll run with the workaround solution that I have just now...

Cheers
TD
 
I would try a 'Compact & Repair' just in case there is something screwy

Peter
 
Sound like the form is just being hidden.
 
Dennisk said:
Sound like the form is just being hidden.

Hmm think you might be right.

When I come out of the form (using the above method of 'closing') then i cannot go into any other querys' as it reckons i have a lock on a table... That would suggest to me that neither of

DoCmd.Close acForm, "[Add New Membership Details]", acSaveNo or

DoCmd.RunCommand acSaveNo

being used to close the form are actually closing the form..
So back to square 1....

How can I close the form from VB code and not leave it hidden! Surely this must be straightforward?
 
but it still retains if closed manualy,
 
you probably dont want [] with
DoCmd.Close acForm, "[Add New Membership Details]", acSaveNo

Peter
 
Bat17 said:
you probably dont want [] with
DoCmd.Close acForm, "[Add New Membership Details]", acSaveNo

Peter

and removing the [] from the form name, combined with adding in a cmd to close the table the form updated leaves the system running great!!!

Many Many Thanks Peter!
 

Users who are viewing this thread

Back
Top Bottom