Connecting Tech Pros Worldwide Forums | Help | Site Map

Default Value set the same as last valus for field

John Burns
Guest
 
Posts: n/a
#1: Nov 13 '05
This should be a nice easy one for you lot.

I have got a Combo box, with its source as a value list - there are only two
options, AM and PM.

I want to set a default value in the box, depending on what the value for
the field was in the last record.

In other words I want to fill out a form, and select either AM or PM in the
list, then in the next record I want the AM/PM box to automatically take the
value that was last used.

Thanks
JB



Allen Browne
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Default Value set the same as last valus for field


Use the AfterUpdate event procedure of the combo to set its DefaultValue

Private Sub cboAmPm_AfterUpdate()
With Me.cboAmPm
If Not IsNul(.Value) Then
.DefaultValue = """" & .Value & """"
End If
End With
End Sub

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"John Burns" <John.Burns2@BAESYSTEM.con> wrote in message
news:40ed5aee_1@baen1673807.greenlnk.net...[color=blue]
> This should be a nice easy one for you lot.
>
> I have got a Combo box, with its source as a value list - there are only[/color]
two[color=blue]
> options, AM and PM.
>
> I want to set a default value in the box, depending on what the value for
> the field was in the last record.
>
> In other words I want to fill out a form, and select either AM or PM in[/color]
the[color=blue]
> list, then in the next record I want the AM/PM box to automatically take[/color]
the[color=blue]
> value that was last used.
>
> Thanks
> JB[/color]


John Burns
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Default Value set the same as last valus for field


Thanks,
I knew it would be a simple solution.


"Allen Browne" <AllenBrowne@SeeSig.Invalid> wrote in message
news:40ed5f37$0$24746$5a62ac22@per-qv1-newsreader-01.iinet.net.au...[color=blue]
> Use the AfterUpdate event procedure of the combo to set its DefaultValue
>
> Private Sub cboAmPm_AfterUpdate()
> With Me.cboAmPm
> If Not IsNul(.Value) Then
> .DefaultValue = """" & .Value & """"
> End If
> End With
> End Sub
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia.
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "John Burns" <John.Burns2@BAESYSTEM.con> wrote in message
> news:40ed5aee_1@baen1673807.greenlnk.net...[color=green]
> > This should be a nice easy one for you lot.
> >
> > I have got a Combo box, with its source as a value list - there are only[/color]
> two[color=green]
> > options, AM and PM.
> >
> > I want to set a default value in the box, depending on what the value[/color][/color]
for[color=blue][color=green]
> > the field was in the last record.
> >
> > In other words I want to fill out a form, and select either AM or PM in[/color]
> the[color=green]
> > list, then in the next record I want the AM/PM box to automatically take[/color]
> the[color=green]
> > value that was last used.
> >
> > Thanks
> > JB[/color]
>
>[/color]


Closed Thread