General :: Highlight Subform Textbox Border Color On Focus
Nov 19, 2014
I am trying to highligh a subform textbox a yellow color on focus. However it is highlighting every textbox in that field as it is a continuous form therefore they are all named ThisCount.
Is there a way to highlight just the specific textbox that I am in. I have tried.
Code:
Dim ctlCurrentControl As Control
Dim strControlName As String
Set ctlCurrentControl = Screen.ActiveControl
strControlName = ctlCurrentControl.Name
Set ctlCurrentControl = Screen.ActiveControl
no problem about setting a different border color for a single textbox (or combobox or listbox) which has focus. How about to change, with a small and fast VBA code avoiding to write code for each textbox, the border color (ora other textbox properties) for a many controls in a form?
I tried using 'For each ctrl in Form....', but I got only bad results. All my control are within differente pages in TAB control.
Using Access 2010. I have a form on which I've placed a simple label. I try to set the label border color to black but it shows grey. I can set the border color to #000000 and it's grey. I set it to #000001 and it shows black as expected.
I'm thinking it has something to do with the themes, but shouldn't an exact color code show as expected? As a new member (<10 posts) I can't post an actual link, but here's the text of the location: [URL] ....
I am trying to get the value of a combobox after selecting an "OK" button but get "You can't reference a property or method for a control unless the control has the focus." Most would probably say use .Value but when I press "OK" I am prompted for a value, or as in another case get Null.I tried setting the focus prior to the violating line of code, but no go.
Example:
Code: Private Sub viewByRegionOKButton_Click() DoCmd.OpenReport "byRegionReport", acViewPreview, , "RegionName = '" & regionComboBox.Text & "'" End Sub
I have synchronized a form with a subform with the following code:
Private Sub YourField_DoubleClick() 'this code is behind the subform Dim rs As Object Dim strLinkValue As String 'value in link field of the subform strLinkValue = Me![NameOfLinkFieldOnSubform].Value Set rs = Forms!YourMainForm.Recordset.Clone rs.FindFirst "[NameOfLinkFieldOnMainForm] = '" & strLinkValue & "'" Forms!YourMainForm.Bookmark = rs.Bookmark End Sub
Every thing works fine but now I would like that the row in subform remains selected in the subform when the user doubkeclicks the record in the subform.Now after doublecliking the subform highlight the first row.
I am exporting a report from access 2010 as PDF to email and the email attachment is coming highlighted. I need it to be white like the report when seen on screen with alternate rows to NO. if I export it to PDF and view it from within access it comes perfect, but when exported to an email, its coming shaded.
I have a form with a textbox which when users enter a unique number(barcode) I want to run a query which pics up the barcode number, checks against the product id and fills the subform with the name of the product and price.
The basic details of the product table is like:
product id (Autonumber) prdoduct name (text) price barcodeId (number)
The subform where i want the result to go is the order details fields product name and price.
I am trying to figure out how to do this but my mind keeps going blank, its been a long while since i used ms access.
In a form, I go to a textbox with setfocus. The whole text is selected then. But how can I place the cursor after the existing text, so that I can begin writing immediately?
I have unbound TextBox in continuous form and I would like that it never get focus. In property I specified Enabled=No and Locked=Yes. But it doesn't work.
i have a report which i need to make certain results displayed in Red, if there is a check in the box.
example:
my report is called OEEModel on the form i have a chkbox - called "FailureModeInPlace" i also have 2 text boxes called "EventCode" and "CodeDescription"
what i want to do is for each record that is displayed with a chkbox ticked that the font in the two boxes turn red and bold...
In my table (tbl_data) I have a field named Rating. This can be anything from 1 - 10.
On my form (frm_input) I have a textbox (created using the wizard so at the moment I'll call it txt_Rating).
What I would like to know how to do is:
If the value in the textbox is 0-5 leave the background colour of the textbox white with black font. If the value in the textbox is 6-7 turn the background colour pale yellow with black font. If the value in the textbox is greater than 7.1 turn the background colour Red with white font.
Does anybody know of a way that I can highlight a row or change colours of all the text fields on a continuous subform when the mouse MOVES over a particular row.
Conditional Formatting seems the way to go and I've also tried the 'Stephan Lebans' method but that seems to require a 'row number' stored in a table in order for it to work, which is not very practical.
I would like continuous subform as a list box in my file. Now when click fields on my form the entire record will not be highlighted. In the sample I have found from the net when click on each field in the form entire row will be highlighted. So I try to using function in the sample for my own but it does not work and when I click on each field just that field in 1 second will be highlighted and entire row will not be highlighted.
Private Sub P_ForceHighLight() On Error Resume Next Dim ct As Control, ct1 As Control DoCmd.Echo False Set ct1 = ActiveControl For Each ct In Me.Detail.Controls ct.SetFocus
I have two unbound unlinked subforms residing on a 3rd unbound main form. When I enter the current record on Subform1 I would like the matching record(s) on Subform2 to be highlighted or otherwise formatted. I can get this to work for only the first record on subform2 due to the way I have my code setup on Subform1:
Code: Private Sub Accounting_Unit_Enter() 'find where AUs match. only works for first Subform2 record If Me.[Accounting Unit] = Forms!MainForm.[Subform2]!AccountingUnit Then msgbox "Match" End If End Sub
My thought was that I needed to reference the Recordset of Subform2 and search for all AccountingUnits that match the current AccountingUnit of Subform1,
I have a new staff member in my office that has informed me that she has a degree of dyslexia. To assist her I've trialled changing the textboxes on one form in my Access 2013 application to a light pink color & this has instantly worked for her to read/input text.
Is there a way to automatically change each textbox to light pink on every form in my application on startup based on user login (say using an IIF statement in the OnLoad event of the startup form).
I have 4 nested forms: DataEntryMaster DataEntryMainSub (subform on DataEntryMaster) DataEntrySub2 (subform on DataEntryMainSub) DataEntrySub3(subform on DataEntrySub2)
In the AfterUpdate even of DataEntrySub2, I have code that checks to make sure the field on DataEntrySub3 (it has only one field) has been filled in. If not, I want to set the focus to DataEntrySub3.
The code in the DataEntrySub2 afterupdate event: if isnull(me!dataentrysub3.productbarcode then msgbox "You must enter a product barcode!" forms!dataentrymaster!dataentrymainsubform!setfocu s forms!dataentrymaster!dataentrymainsubform!dataent rysub2.setfocus forms!dataentrymaster!dataentrymainsubform!dataent rysub2!dataentrysub3.setfocus end if
I've used this most-wordy syntax because I couldn't get the shorter syntax (eg, me.dataentrysub3.setfocus) to work at all. However, this STILL doesn't work.
What's really puzzling is that if I run those exact same 3 setfocus statements from the immediate pane, they work fine. But in the afterupdate event, my focus always ends up on a control in dataentrysub2.
Well, the title says it all really. After I click into the subform and type something in a text box, the focus will not return to the parent form, via mouse or tab. I can't even switch the form back into design view, it appears to be totally locked. Has anyone run into this before?
i won't go into details except i am doing databases for cemeteries - very complicated example i have come across two people who have the same name, date of death, buried in the same grave on the same day but are not related and must have seperate records!! my main table has 6 primary keys. [even then i have 2 duplicates who are not related] anyway one of the problems is this i have a main form with 2 subforms. the main form is unbounded. i need to copy information from 1 of 4 queries run by the main form [QBF] to one of the subforms. i don't know which query untill i view the data. when i know which one, i press a command button which copies the information to one of the subforms. when i repeat the actions above instead on the new query data going into a new record on the subform it overwrites the existing data instead of pasting it into a new record. i have tried setfocus command - this works only if i click on the subform and activate it [this defeats the object of the command as i might just as well click in a new record box on the subform]. in essence i do not need to activate this subform at all. i just need to check if a record exists and if it does goto a new record [again this works only if i physically click on the form] any ideas how i can force the cursor to goto a new record without physically clicking on the subform??
If i open a form with a sub form on can i open it so that the focus go directly to a control on a sub form.I have tried to do it with a macro on the on open event to go to control but it comes up that the control don't exists on the sub form.i am using access 2010.
When I click on my subform after entering some data in the primary form, I get this error message:
"The Microsoft Jet database engine can't find a record in the table <name> with key matching field(s) <name>. (Error 3101)"
This is because I have not filled in a ItemCode, a combobox, on the parent form and ItemCode is part of a one-to-many relationship that involves automatic filling in of other fields such as ItemDesc, UnitPrice, etc. How do I code the validation that handles such an error?