Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 30th, 2005, 06:34 AM
Authorized User
Join Date: Jun 2003
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Setting Default Value at run time

Dear All
I have a combo box cboInvest on a form with the default value blank, cboInvest is linked to another table. On entering data if there is no default investigator declared, I wish to give the user the opportunity to set a default value. I am using the following code in the cboInvest Before Update method, it appears to run without error but on rechecking the default value in the properties of cboInvest there is still no default set. What am I doing wrong?

Dim intAnswer2 As Integer

If Me.cboInvest.DefaultValue = "" Then
intAnswer2 = MsgBox("There is no default investigator set would you like " & Me.cboInvest.Value & _
vbCrLf & "to be set as the default investigator?", vbQuestion + vbYesNo, "Default setting")
If intAnswer2 = vbYes Then
Me.cboInvest.DefaultValue = Me.cboInvest.Value
DoCmd.Save acForm, "Patient information"

End If
End If

Any suggestions most welcome

Old October 3rd, 2005, 06:51 AM
Registered User
Join Date: Oct 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

i think the best way to store the value in GLOBAL VARIABLE AND SET THE VALUE USING EVENT 'ON OPEN'

Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting default value in drop down. rupen Classic ASP Basics 4 July 3rd, 2014 02:00 AM
Setting a DetailsView Insert default value jpullam ASP.NET 2.0 Basics 13 April 7th, 2014 02:19 AM
Setting the default.aspx for all users Caster BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 April 13th, 2007 02:45 AM
setting default values prithvi28 XSLT 1 October 3rd, 2006 01:38 PM
setting default month jtyson ASP.NET 1.0 and 1.1 Basics 1 June 30th, 2003 12:44 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.