Prev: From temporary table to master table and then join this in junction table
Next: Apply changes to existing records
From: deb on 8 Apr 2010 09:42 acess 2003 I have a subform called fwarranties with a combobox called UnitNo other fields are changed based on the selection in UnitNo How can I make the user select from the combobox UnitNo before entering any other data on the form? UnitNo must have data first. -- deb
From: Daryl S on 8 Apr 2010 10:40 Deb - You can set the enabled property (or the visible property) to Fasle in design mode. Then in the AfterUpdate event of the combobox, if a selection is made then add code to set those values to true. Me.txtbox.enabled = True or Me.txtbox.visible = True -- Daryl S "deb" wrote: > acess 2003 > > I have a subform called fwarranties with a combobox called UnitNo > other fields are changed based on the selection in UnitNo > > How can I make the user select from the combobox UnitNo before entering any > other data on the form? > > UnitNo must have data first. > > -- > deb
From: Dirk Goldgar on 8 Apr 2010 10:47
"deb" <deb(a)discussions.microsoft.com> wrote in message news:543E38D4-2D8A-4C68-B469-C745364CB233(a)microsoft.com... > acess 2003 > > I have a subform called fwarranties with a combobox called UnitNo > other fields are changed based on the selection in UnitNo > > How can I make the user select from the combobox UnitNo before entering > any > other data on the form? > > UnitNo must have data first. One solution would be to disable all controls on the form (the subform, that is) until UnitNo is not Null. To do this, you would use the Current event of the form and the AfterUpdate event of the combo box. Something along the lines of: '------ start of example code ------ Private Sub EnableDisableControls() Dim blnEnabled As Boolean blnEnabled = Not IsNull(Me.UnitNo) ' If we're going to disable contols, make sure the ' focus is on UnitNo. If blnEnabled = False Then Me.UnitNo.SetFocus End If ' Enable/disable other controls. Me.SomeControl.Enabled = blnEnabled Me.SomeOtherControl.Enabled = blnEnabled ' ... and so on ... End Sub Private Sub Form_Current() EnableDisableControls End Sub Private Sub UnitNo_AfterUpdate() EnableDisableControls End Sub '------ end of example code ------ -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup) |