473,385 Members | 2,069 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Default Value set the same as last valus for field

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
Nov 13 '05 #1
2 6820
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" <Jo*********@BAESYSTEM.con> wrote in message
news:40********@baen1673807.greenlnk.net...
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

Nov 13 '05 #2
Thanks,
I knew it would be a simple solution.
"Allen Browne" <Al*********@SeeSig.Invalid> wrote in message
news:40***********************@per-qv1-newsreader-01.iinet.net.au...
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" <Jo*********@BAESYSTEM.con> wrote in message
news:40********@baen1673807.greenlnk.net...
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


Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sophie Bradshaw | last post by:
i was wondering if anyone could possibly help me! i have a ms access database, and in one of the tables, one of the fields is a lookup column, with several possible values. what i want to do is...
11
by: David Messner | last post by:
Ok I know this is simple but the statement eludes me... I have a date field where I want the default value on the data entry form's date field to be the last date entered. I figure I can do this...
0
by: Nithin | last post by:
My code as an txt attachment. I have 2 drop down list boxes that on selection populate text boxes from my database table. I am able to display the correct values in these text boxes. I have 2...
4
by: Dennis | last post by:
I am trying to set the default design proerties in a control I have derived from the Panel Class. I thought I'd found how to do it from the MSDN but the following line doesn't work: Inherits...
44
by: gregory.petrosyan | last post by:
Hello everybody! I have little problem: class A: def __init__(self, n): self.data = n def f(self, x = ????) print x All I want is to make self.data the default argument for self.f(). (I
74
by: Zytan | last post by:
I have a struct constructor to initialize all of my private (or public readonly) fields. There still exists the default constructor that sets them all to zero. Is there a way to remove the...
4
by: rczuba | last post by:
Problem: Creating a Default Value for a field in a subform when a field in the subform & form match. I'm trying to create a payroll database for a small home business that I have that has had...
4
by: ARC | last post by:
I have a form with a first name and last name field right next to each other. The last name field has no label. I'm using: defaultvalue="" and defaultvalue =="" for new recs so a beginner-type...
5
by: Henry J. | last post by:
I know this could be a dumb question, I just want to confirm that it is faster to execute inserts, if a timestamp field is set to have a default value, like DEFAULT CURRENT TIMESTAMP, and skip that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.