Modules & VBA :: Combobox Not Enabling / Setfocus Field
Nov 19, 2013
The code I'm using should work, it doesn't, though similar code from a Text control does work. Basically, if someone selects "Other" I want [Chg_Type_Oth] to be Enabled and SetFocus.
The cmb_Chg_Type combo box, that stores into Chg_Type, has the following entries to select:
"Equipment New";"Equipment Modified";"Operator New";"Operator Move";"New Process / TTD";"Other";1
-I added "1" to see if that was the issue, but alas that didn't work either
Here is the code that isn't working (using two variations, just in case I was hitting an Access Wall, and the Select Case is purposely remarked out):
Private Sub Cmb_Chg_Type_AfterUpdate()
' Select Case Me.cmb_Chg_Type
' Case "Other"
' Me.Chg_Type_Oth.Enabled = True
' Me.Chg_Type_Oth.SetFocus
[Code] ....
Though this works fine from an ordinary text box:
Private Sub Chg_Name_AfterUpdate()
If Me.ChangeName = "Other" Then
Me.Chg_Type_Oth.Enabled = True
Me.Chg_Type_Oth.SetFocus
End If
End Sub
Anyway, I'm expecting something obvious will show up...
View Replies
ADVERTISEMENT
Oct 24, 2006
Hi everyone,
Firstly apologies for posting what is likely to a really simple problem and probably has been explored before. I have been looking through other treads but nothing that I could identify really fits the bill.
Essentially based on choices made against a combo-box, I wish to lock or hide combinations of fields/combo box within the form. Realistically I want to lock rather than hide.
All the fields/combo boxes in the form I want to effect are bound.
I can effectively do this as long as the fields/combo-boxes are unbound, but it seem to fail when they are bound.
Any assistance would be really helpful so thanks in advance.
View 3 Replies
View Related
Jan 27, 2014
I have combo box in a form. I want to enable (to highlight) some controls in the form after selecting any value from my combobox.
For example, There are three values in the combobox. And :
When I select value1, I want an unbound combobox1 to be enable (This combobox is synchronized with a bound combobox2). So when this unbound combo is enabled, its synchronized bound combo should also be enabled.
When I select value 2, it should do the similar action on a different unbound combobx3 (which is synchronized with a combobox4).
View 11 Replies
View Related
Apr 8, 2005
When I open the “FrmStudentEnrollment” form in the attached db and enter a license number in the License number field (this field is inside a subform) that is not in the db, the “FrmStudentInfo” form opens allowing student information to be entered. After entering student information in the “FrmStudentInfo” form I have a close command button to return to the “FrmStudentEnrollment” form.
This is where I need help! I would like, when returning to the “FrmStudentEnrollment” form for the focus to be on the “AttentDate1” field located in the subform “FrmStudentInfo”. I used the LicenseNo Combo Box NotInList VB from Northwind db but there seems to be problems here too.
View 1 Replies
View Related
Jan 22, 2006
Hi, I have a field in a form that says when you are able to book a certain event, and i want the field in which the event can be booked, to remain unable to be edited until the tick box says yes. Is that possible?
Chris
View 4 Replies
View Related
Feb 24, 2015
I have a from that has information icons that opens a separate form to support users make the right choice on a form. With each information form users are able to choose "Yes" or "No" and then it returns them back to the form they started. I am having trouble setting the focus to the control the user original left the form from.
Form A
Control 1
Control 2
Control 3
Form B
Information for Control 1
Form C
Information for Control 2
Form D
Information for Control 3
For Forms B - C I would like the form to close, open Form A and then set focus to the control that the form was providing information for.For example, if you are on Form C and you make a decision, I want Form C to close, Form A to open and focus to be set to Control 2.
Code:
Private Sub image5_Click()
Dim sWHERE As String
Criminal_Background.Value = "Yes"
[code]...
View 8 Replies
View Related
Jun 24, 2014
I am using John Big Booty's code for narrowing down the content of a listbox. It works beautifully, with the exception of when I type the character "i" into the search box it gives me a Runtime 2110, cannot setfocus error. I have run through the entire alphabet in lower and upper case and consistently get the code failing on lowercase i only.
Here is the code:
Private Sub searchFor_Change()
'Create a string (text) variable
Dim vSearchString As String
'Populate the string variable with the text entered in the Text Box SearchFor
vSearchString = searchFor.Text
[Code] ....
Here is the link to the original thread that the code came from. [URL] ....
View 3 Replies
View Related
Mar 4, 2014
Basically I have a continuous form with each record having a textbox and a checkbox. There can only be one checkbox ticked per record but what I want to do is to stop the other checkboxes from being ticked if one is already ticked.
View 2 Replies
View Related
Jan 13, 2015
I'm using form with subform. Main form header contain a combobox. I need to check the combobox is null or not before update a subform filed. If combobox is null then its back to Main form combobox from subform. The code below that I'm trying to:
Code:
Private Sub AssignTo_BeforeUpdate(Cancel As Integer)
If IsNull(Forms!frmDepartmentReview!cboDepartment) Then
MsgBox "You must select Department first", vbInformation
Forms![frmDepartmentReview]![cboDepartment].SetFocus
End If
End Sub
Then I'm getting 2110 run time error
Access can't move the focus to the control cboDepartment.
View 4 Replies
View Related
Aug 30, 2013
I'm using a combobox to select a record based off my primary key field, and then a separate button to print that particular record.
When the form loads, it has the first record selected but the combobox is empty so that if I press my button it will still print the first record.
when I press the combobox my list of entrys in the primary key field shows up and the combobox is no longer blank.
How do I show the first primary key field in the combobox when the form loads?
View 6 Replies
View Related
Apr 11, 2005
How can I set the focus to the first control in a form, without referencing the control name?
Ex. Normally I do:
Me.ControlName.SetFcous
Now I have a code which adds a new record, which is used on several forms, therefore the control name is not always the same, so I would like the focus to move to the first field on the tab order. Any ideas please?
View 2 Replies
View Related
Aug 25, 2004
I am just learning VB, much less Access, even more so how to just understand all the code. My conundrum: In my form, I have 4 sets of tabs (not pages - each tab contains +/- 8 pages). Each tab is controlled visibly by 1 of 4 text boxes within the form, not positioned within the tabs. When each respective control is clicked, it is bolded (i.e. fontbold = true) and its repective tab set becomes visible (i.e. true), "hiding" the other 3 tab sets (i.e. visible = false). This is dependent on changing setfocus to the control (according to my error messages which say I cannot move the setfocus to the control or I can't hide a control that has the focus). After I try to setfocus to Tab2 and click the control for Tab2, it says the same thing, that I can't hide a control that has the focus. I've tried setting focus to the tabs, to the labels that control the tabs, to labels within the tabs, and to text within the tabs - all to no avail. If anyone has a suggestion, I would be most appreciative. Cheers.
View 3 Replies
View Related
Apr 13, 2006
If a user enters too many characters into a field I want to display a message and then keep the user in that text box until less characters are entered.This is the codePrivate Sub txtTitle_LostFocus() txtTitle.Value = LTrim(txtTitle.Value) If Len(txtTitle.Value) > 50 Then MsgBox "Title is too long. Can not be more than 50 characters", vbOKOnly, "Title Too Long" txtTitle.SetFocus End IfEnd SubThe message appears but focus moves to the next text box almost as if the setfocus command has been ignored.Anyone got any ideas as to why??Thanks
View 6 Replies
View Related
Apr 26, 2005
My form is in tabular form so it is just a running list. How do I SetFocus to a new record when the form is opened?
View 4 Replies
View Related
Jul 13, 2005
I have a form with a button that when clicked triggers "find" in a field that is located on the form...
[code]Private Sub Command23_Click()
DoCmd.GoToControl "last name"
DoCmd.RunCommand acCmdFind
End Sub [code]
When the record is found and the user presses "esc" to close the find box I would like to set the focus in a field located in the subform...
[code] Private Sub Form_Current()
Me.LT2DataEntrySubform1.Form!QRt.SetFocus
End Sub [code]
Problem is after the user presses "Esc" both the field on the form that is used to seach on and the field in the subform that I set the focus on have the focus. Yes...both fields have focus and unless the user clicks on some other field no dataentry can be done.
Any suggestions would be appreciated.
Thanks
View 2 Replies
View Related
Jan 19, 2006
Hello,
I have litle problem regarding SetFocus.I have 2 Forms - form1 and form 2.On form 1 I have txtSomething and when I open form2 I can not SetFocus on txtSomething.I have tried with
Forms!Form1!txtSomething.SetFocus
but something wrong,can someone help,
thanks
View 5 Replies
View Related
Feb 15, 2006
I'm having an issue with part of my code. I have a logout function which closes one form and then reopens the login form. It does this fine, but I can't type in any of the text boxes on the login form unless I close it out and reopen it manually. Here's the code:
vb Code: Original - vb Code Private Sub cmdLogout_Click()On Error GoTo Err_cmdLogout_ClickDoCmd.OpenForm "userlogin", acNormal, , , acFormReadOnly, acWindowNormalForms!userlogin!txtuserid.SetFocusDoCmd.Close acForm, "Control Panel", acSaveNoForms!userlogin!txtuserid.SetFocusExit_cmdLogout_Click:Exit SubErr_cmdLogout_Click: MsgBox Err.Description Resume Exit_cmdLogout_ClickEnd Sub Private Sub cmdLogout_Click()On Error GoTo Err_cmdLogout_ClickDoCmd.OpenForm "userlogin", acNormal, , , acFormReadOnly, acWindowNormalForms!userlogin!txtuserid.SetFocusDoCmd.Close acForm, "Control Panel", acSaveNoForms!userlogin!txtuserid.SetFocusExit_cmdLogout_Click:Exit SubErr_cmdLogout_Click: MsgBox Err.Description Resume Exit_cmdLogout_ClickEnd Sub
I've tried setting focus as shown above, but still no luck. Any ideas?
Thanks,
JMH
View 2 Replies
View Related
Jan 17, 2008
I'm by no means an expert when it comes to using access and its many controls that are avaliable to use on forms. Thats why I've come here to seek your help.
I have a database that has been created by someone who has now left the company and it needs a little work done to it.
The ideal thing we would like to get working on form, is that we would like a number of options to be greyed out and only accessable when another option is ticked.
I'm not sure how to group these options together, nor an I sure how make them active only when an specific tick box is ticked. Any help would greatly appreciated on this matter.
Thanks for your time and patience.
Menes.
View 5 Replies
View Related
Mar 10, 2005
Working in the theatreworld, I'm trying to create something which will usefully combine my contacts and also a database of which shows we have done (dates, actors involved etc, etc) and what shows we have bought in.
So far, I have created my form which has the usual fields (name, address and so on) and also a field which asks users to describe what type of contact they are ie. are they an actor, or a director, or a theatre company.
There are also two command buttons, which will either open up another form which lists all the productions they have been in with us over the years (In-house productions), or one that opens up another form which lists what shows each theatre company has brought to us.
I would like to be able to select 'actor' in the category field which will then enable the command button for me to see what productions that person has been in. Or if I selected the 'theatre company' category then the other button becomes enabled.
Can anybody advise me on this please? Alternatively, if this all sounds far too convoluted, then I am open to suggestions!
Many thanks in advance,
Popps
View 1 Replies
View Related
Feb 23, 2006
Hi,
For some reason when I set the focus to a text box in the subform it clears the textboxes there.
First I set the values of 2 of the textboxes in the subform programatically. Then I tab to the last control in the main form. This is the code I have in the lost focus event of that control:
Forms!frmDrawingsRegister!frmDrawingRevisions.SetF ocus
Forms!frmDrawingsRegister!frmDrawingRevisions!txtL atestIssueDate.SetFocus
frmDrawingsRegister = main form
frmDrawingRevisions = subform
I have set the Cycle property of the subform to Current Record.
Why would this be happening?
View 1 Replies
View Related
Apr 24, 2005
I have a form with numerous fields and would like to be able to move the focus to a selected field by typing the field name into a control box. How can I do this? TIA
View 4 Replies
View Related
May 5, 2005
I have a main form with a subform which in-turn also has a subform (in datasheet mode). When the user clicks a button on the main form I want to disable all of the controls on the subforms. This works fine until the user clicks the button while the focus is on one of the text fields in one of the subforms. It rightly complains that the control can't be disbled while it is in focus. To circumvent this problem I've tried setting the focus to another field before disabling the control. However this doesn't seem to work. It seems to ignore the setfocus and still flags the original error. Is it not possible to set the focus of a subform from the main form?
Example:
[subfrm1].Form![Field2].SetFocus
[subfrm1].Form![Field1].Enabled = False
This fails if the focus was in Field1 at the time of executing the code.
Any ideas?
View 3 Replies
View Related
Nov 28, 2005
Hello,
I have a continuous form. On that form, I have a link (label) that a user can click to bring up a new form containing more info on the current record. The problem is that when the form opens, the first record is selected. If the user scrolls down to another record, and clicks the link, the form opens with info on the first record.
It seems that I need to set the record to the record that the link was clicked from, but I'm not sure how. Any help?
Thanks,
Eric
View 14 Replies
View Related
Feb 13, 2006
I'm using the following code (from GHudson) to check for required fields being filled in but it stops at a particular combo box and gives the error message Runtime error 2110 "can't move the focus to the control" although it works on previous combos which are set up in the same way.
Private Sub Close_Click()
'Key "Required" in the Tag property of the form object.
Dim ctl As Control
For Each ctl In Me
If ctl.tag = "Required" Then
If IsNull(ctl) Or ctl = "" Then
MsgBox "You must complete all required fields to continue. Your cursor wll now be set to the missed field", vbCritical, "Required Field"
ctl.SetFocus
Exit Sub
End If
End If
Next
Set ctl = Nothing
DoCmd.RunCommand acCmdClose
'If MsgBox("Have you selected the record type and filled in the other yellow fields? These are mandatory. If you haven't - click on 'No' to return to form", vbQuestion + vbYesNo, "Open Form?") = vbYes Then
'DoCmd.SetWarnings False
'DoCmd.RunCommand acCmdClose
'DoCmd.SetWarnings True
'End If
End Sub
View 3 Replies
View Related
Nov 10, 2006
Sorry if this has come up before, I have been chasing dozens of threads that are so close, I've still not got it!:o
I have a form that is used in edit mode and add mode. When used in edit mode it has a combo box in the header that does the usual bookmark search in the after update event, and on open focus is set to this field in the open form event.
When in add mode i don't want this set focus to happen so I'm not sure what the test statement should be.:confused:
Would appreciate a pointer or two.
lightray
View 14 Replies
View Related
Oct 1, 2005
Hi all,
I was just wondering if it is difficult to enable a cmd button when a text box has been filled in. I have a button that allows users to add a file which displays the filepath in a text box. So what I wanted to do was when the path appears in the text box then this will enable the button. I thought that It may have been something like
Private Sub FilePath_Change()
cmdOpen.Enabled = True
End Sub
but as usual i was wrong lol
Anyone got any advice on this , thanks
J
View 1 Replies
View Related