is there a macro that clear field counter to 0??

realmadrid

Princess
Local time
Tomorrow, 03:13
Joined
Jan 26, 2011
Messages
28
hi,
i made an easy software in access.now when i go to the search form from the switchboard, the previously saved records are already shown in the fields. now m trying to make a macro that clear the counter or make the counter=0 so that whenever i come on the form, i see the fields blank but i cant find any such option in macro or is there any other way out???
 
Sounds like you want the DataEntry Property of the form set to Yes.
The form then only accepts new records and does not display existing one.

Not sure what you mean by the counter.
 
Also not sure what you mean by the counter, though I assume you simply mean that you don't want details of a specific record to be shown when the form opens.

Given that you called it a search form I assume it is a form to search a table based on multiple criteria. The way I would achieve this is by having an unbound search form with controls for each search criteria and a subform bound to the result. you then hide the subform and have the search command button set the visible property to true after requerying the subform.
 
I think the OP would like a macro that will cause the form to move to a new record. I would imagine he/she would like to run this in the click event of a button.

Action
- RunCommand
Arguments - RecordsGoToNew
 
hi,
i made an easy software in access.now when i go to the search form from the switchboard, the previously saved records are already shown in the fields. now m trying to make a macro that clear the counter or make the counter=0 so that whenever i come on the form, i see the fields blank but i cant find any such option in macro or is there any other way out???

The bolded parts make me think he has a form which searches a query/table which he wants to not display any results until the criteria has been entered and a command button pressed to search.

But it's not the clearest request, so I could be wrong.
 
One can only surmise. That's we just give out as many solutions as we see fit. :confused:

It's certainly not a clear post.
 
Sounds like you want the DataEntry Property of the form set to Yes.
The form then only accepts new records and does not display existing one.

Not sure what you mean by the counter.

the counter word is in another computer language which means clear off data from the fileds if it is set to 0. i tried data entry field set to YES that actually do what i want (means when i open the form, the fields are empty) but then it makes the search button disable & gives an error which says: "The command or action "find" isn't available now"
 
If it's set to data entry it is purely an input form, you will not be able to search & view existing records.

Perhaps something as simple as going to a new record on the On Open event of the form will solve your problem. You will need to turn data entry mode off again though.

Basically the solution posted by vbaInet in post 5 but on the On Open event rather than a command button.

That should mean that on opening the form it goes straight to a new record but as data entry mode is not on you will still be able to view existing records.
 
ok now what is working with me is i made a button that is actually an add a new record button which has the nested feature of clearing the fields and i named it as CLEAR. the data entry is still set to NO cos if i change it to yes the button doesnt work anymore & gives an error message. Now this (add a new record) button named as clear is added to all the forms like create-search-modify-delete & navigate but the only thing is every time i visit a form i have to press the clear button to clear all the field sets. That is the least i can do with this. :cool:

if you have any other suggestion, it will be highly appreciated !!

thanks alot for all those who helped me out in this.... appreciate your kind concern :)
 
If you had to clear the controls after calling the new record function then I guess you were trying to clear unbound fields.
 
In post #5 I gave you the macro action for creating a new record. If you want this to run when the form opens, set the macro in the LOAD event of the form (under the Events tab in the form's Property Sheet).
 
no all the fileds are bounded but my main focus was to clear the fields actually so that is done. :D :D
 
If they are bound then the solution offered by vbaInet and myself (new record on load / open) should eliminate the need to click the button each time you open the form.

There should be no need for your "nested feature" as bound fields will all be either blank or set to the default value (check the controls on the form / fields in the table to check this), however you could include this on the load / open event too.
 
...also clearing all fields means updating them to Null and this isn't a wise thing to do.
 
I think the OP would like a macro that will cause the form to move to a new record. I would imagine he/she would like to run this in the click event of a button.

Action - RunCommand
Arguments - RecordsGoToNew

very sorry i skipped this post. i tried & its working. Much better way of doing it then like i did :(
 
very sorry i skipped this post. i tried & its working. Much better way of doing it then like i did :(
I too miss posts by others. I only just noticed that CBrighton had mentioned putting the code in the Open event - Load event is more suitable though.

If you're using a command button for opening the form, you can also do it here:

docmd.OpenForm "FormName", , , , acFormAdd
 
I think the OP would like a macro that will cause the form to move to a new record. I would imagine he/she would like to run this in the click event of a button.

Action - RunCommand
Arguments - RecordsGoToNew


this was very very useful.....i put the above command in the ONLOAD of the form properties....now when ever i visit the form, the time the form gets load it clears the fields & this way the buttons are also working...:D:D
 

Users who are viewing this thread

Back
Top Bottom