adding record on form

  • Thread starter Thread starter FubarDave
  • Start date Start date
F

FubarDave

I want users to input certain data into a new record on a form.

The remaining data I want to complete automatically.
Firstly would I write this code under the Before Insert [Event Procedure]
and if not then where?

Secondly how do I write the code. I have tried Me.Fields![Fieldname].Value =
etc. but it does not work.

Can anyone help ?
 
Before Insert will work or Before Update if you want it to work when updating
existing records as well.
You just need Me!ControlName = 'value'
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".
 
Dorian,

what if it is a field and not a control that I want to enter data for ?
Thanks for the reply,

Dave

Dorian said:
Before Insert will work or Before Update if you want it to work when updating
existing records as well.
You just need Me!ControlName = 'value'
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


FubarDave said:
I want users to input certain data into a new record on a form.

The remaining data I want to complete automatically.
Firstly would I write this code under the Before Insert [Event Procedure]
and if not then where?

Secondly how do I write the code. I have tried Me.Fields![Fieldname].Value =
etc. but it does not work.

Can anyone help ?
 
On a form, fields (or more properly table columns) are in controls. Each
control is 'bound' to a field. If you want to input data for a field that is
not on the form, you need to create a control to bind it to and then make the
control hidden by setting the visible property to FALSE. You can then set its
value in your code unbeknownst to the user who will never see it.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


FubarDave said:
Dorian,

what if it is a field and not a control that I want to enter data for ?
Thanks for the reply,

Dave

Dorian said:
Before Insert will work or Before Update if you want it to work when updating
existing records as well.
You just need Me!ControlName = 'value'
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


FubarDave said:
I want users to input certain data into a new record on a form.

The remaining data I want to complete automatically.
Firstly would I write this code under the Before Insert [Event Procedure]
and if not then where?

Secondly how do I write the code. I have tried Me.Fields![Fieldname].Value =
etc. but it does not work.

Can anyone help ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top