Current Record as Default

D

DS

How do you set the current record that you are on as the default. I
want a button on the form where I can push it and whatever record I am
currently on will set the fields in any future records that I add what
they are currently.
Thanks
DS
 
A

Alex White MCDBA MCSE

There is a default property on all controls that sit on forms, I have not
tested this so you will have to try this out

your button is called cmdDefaults

event code for the button cmdDefaults

the code below is *** Air code ***

For Each ctl In Me.Controls
' you need to make sure there is a default property
if not isnull(ctl.value) then
ctl.default = ctl.value
end if
Next ctl

DoCmd.Save acForm, Me.Name

I have never done the above but I think it will work.
 
D

DS

Alex said:
There is a default property on all controls that sit on forms, I have not
tested this so you will have to try this out

your button is called cmdDefaults

event code for the button cmdDefaults

the code below is *** Air code ***

For Each ctl In Me.Controls
' you need to make sure there is a default property
if not isnull(ctl.value) then
ctl.default = ctl.value
end if
Next ctl

DoCmd.Save acForm, Me.Name

I have never done the above but I think it will work.
Thanks Alex, I've been playing with it and if you do this it works

Me.ControlName.DefaultValue = ControlName

Thanks, Once Again.
DS
 

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

Top