Hi Jon,
And with Data tab set "Data Entry" : Yes.
If you have this property set to Yes, then you should have never seen
existing data for the first record, as you indicated in your previous post.
The navigation buttons should indicated Record 1 of 1, until you add your
first record. Then you will be able to see new records just added, until you
close this form. The next time you open it, you should be back to Record 1 of
1. Try turning your Navigation buttons back on, temporarily, to see this.
It's no wonder your macro was dirtying the record. As best I can tell, it
should not necessary to call your macro. If you care to send me a stripped
down version of your database, with the table, fields, form and macro that
you described, I'll be happy to look at it. I simply don't think that you
need this macro, but I'll be able to tell more, by looking at an actual
sample. If you are interested, send me a private e-mail message with a valid
reply-to address. My e-mail address is available at the bottom of the
contributor's page indicated below. Please do not post your e-mail address
(or mine) to a newsgroup reply. Doing so will only attract the unwanted
attention of spammers.
Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
Jon said:
Hi,
Suppose that you have a tbl called emp_tbl, and you want to add new emps to
the tbl. emp_tbl hase five fields: emp_ID(PK), emp_name, sex(male or female),
mobile_No., and email. in this case you need to create a form abound on
emp_tbl to input the data. First of all, create a form (New_emp) and make the
record source of the form be emp_tbl. second , put all field in this form by
drag and dorp. After that you will have 4 txt box and one combo box(for sex
field: male and female) , after that, you need to add a cmd button to add new
record and cmd button to exit from the form. In the form property, set the
format as follows:
Record selectors: No
Navigation buttons: No
Divide lines: No
And with Data tab set "Data Entry" : Yes.
Now I will create a macro and it has the following action:
-SetValue
Action argument:
Item: [Forms]![New_emp]![emp_ID]
Expression: ''
-SetValue
Action argument:
Item: [Forms]![New_emp]![emp_name]
Expression: ''
And so on for the rest of txtbox
-Gotocontrol
Control name: [emp_ID]
After that you need to go to the event tab of the form(New_emp) and go to on
load event and put the macro there.
Finally save your job and test it. You will see blank text and you need to
fill up the txtbox without seeing the previous data.
Hope that i express the idea of the setting value of form.
if you need more clarification, please feel free to ask me?
Thanks