|
Subject:
|
Setting Default Value at run time
|
|
Posted By:
|
skinny
|
Post Date:
|
9/30/2005 6:34:10 AM
|
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
|
|
Reply By:
|
edammat
|
Reply Date:
|
10/3/2005 6:51:35 AM
|
i think the best way to store the value in GLOBAL VARIABLE AND SET THE VALUE USING EVENT 'ON OPEN'
|
|