Current Record as Default

  • Thread starter Thread starter DS
  • Start date Start date
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
 
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.
 
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
 
Back
Top