ted.martin
Registered User.
- Local time
- Today, 14:09
- Joined
- Sep 24, 2004
- Messages
- 743
I have a form that as part of the OnLoad event, looks up some values. (Access 2007)
txtDEVctd.Value = RoundCurr(Nz(DSum("[DEVcost]", "Q-DEVcost", "VORef = " & VarNo.Value), 0), 2)
txtDOVctd.Value = RoundCurr(Nz(DSum("[DOVcost]", "Q-DOVcost", "VORef = " & VarNo.Value), 0), 2)
txtDEVctd.Value and txtDOVctd.Value are UNBOUND
Despite trying everyway possible to open this form in Read-Only, it stubbornly remains in Edit mode because (I have discovered through line by line testing), the txtVOctd.Value text control in the Load code is BOUND when the next line runs.
txtVOctd.Value = RoundCurr(txtDOVctd.Value + txtDEVctd.Value, 2)
Now if I make txtVOctd UNBOUND and instead use the piece of SQL shown below, the form will open Read Only.
DoCmd.SetWarnings False
DoCmd.RunSQL ("UPDATE [Variation Register] SET VOCosttoDATE = " & txtVOctd.Value & " WHERE VARNo = " & VarNo.Value)
DoCmd.SetWarnings True
SO ... my only question is WHY does having txtVOctd as a BOUND control prevent the form from Opening Read only when asked to do so?
I am as ever intrigued. Many thanks
txtDEVctd.Value = RoundCurr(Nz(DSum("[DEVcost]", "Q-DEVcost", "VORef = " & VarNo.Value), 0), 2)
txtDOVctd.Value = RoundCurr(Nz(DSum("[DOVcost]", "Q-DOVcost", "VORef = " & VarNo.Value), 0), 2)
txtDEVctd.Value and txtDOVctd.Value are UNBOUND
Despite trying everyway possible to open this form in Read-Only, it stubbornly remains in Edit mode because (I have discovered through line by line testing), the txtVOctd.Value text control in the Load code is BOUND when the next line runs.
txtVOctd.Value = RoundCurr(txtDOVctd.Value + txtDEVctd.Value, 2)
Now if I make txtVOctd UNBOUND and instead use the piece of SQL shown below, the form will open Read Only.
DoCmd.SetWarnings False
DoCmd.RunSQL ("UPDATE [Variation Register] SET VOCosttoDATE = " & txtVOctd.Value & " WHERE VARNo = " & VarNo.Value)
DoCmd.SetWarnings True
SO ... my only question is WHY does having txtVOctd as a BOUND control prevent the form from Opening Read only when asked to do so?
I am as ever intrigued. Many thanks