Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access 2000 Focus and Disable

Status
Not open for further replies.

RDeen

Programmer
May 17, 2001
1
US
I have a form and two subforms which are placed on three tabs, tbctl1 (Page1, main, Page2, sub, Page3, sub which is programmed to be a sub for Page2). Following is the code behind three switchboard commands;

cmd1:
Private Sub cmd1_Click()
DoCmd.OpenForm "frmAddARisk"
With Forms!frmAddARisk
!Page1.Visible = True
!Page2.Visible = False
!Page3.Visible = False
!Page4.Visible = False
!Page5.Visible = False
!Combo140.Enabled = False
!txtRiskLossHoursActual.Enabled = False
!txtRiskResolutionDate.Enabled = False
!txtRiskEntryDate.Enabled = True
!txtRiskSubmittedBy.Enabled = True
!txtRiskTitle.Enabled = True
!txtRiskDesc.Enabled = True
!txtRiskLossHoursEst.Enabled = True
End With
End Sub

cmd2:
Private Sub cmd2_Click()
DoCmd.OpenForm "frmAddARisk"
With Forms!frmAddARisk
!Page1.Visible = True
!Page2.Visible = False
!Page3.Visible = False
!Page4.Visible = False
!Page5.Visible = False
!Combo140.Enabled = True
!txtRiskLossHoursActual.Enabled = True
!txtRiskResolutionDate.Enabled = True
!txtRiskEntryDate.Enabled = False
!txtRiskSubmittedBy.Enabled = False
!txtRiskTitle.Enabled = False
!txtRiskDesc.Enabled = False
!txtRiskLossHoursEst.Enabled = False
MsgBox "To Modify A Risk You Must Select A Risk Title"
End With
End Sub

cmd3:
Private Sub cmd3_Click()
DoCmd.OpenForm "frmAddARisk"
With Forms!frmAddARisk
!Page1.Visible = False
!Page2.Visible = True
!Page3.Visible = False
MsgBox "To Add A Risk Cause You Must Select A Risk"
End With
End Sub

I have two issues…
1. When I try the cmd3 button first (which is Page2), I get the error “You can’t hide a control that has the focus”. (Don't want that!)
2. I want to disable fields on Page 2 until the combo box (on Page 2) is selected.

I have tried coding this… I hope it is specific enough. Does anyone have code and advice as to where to put it?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top