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
|