Modules & VBA :: Color Row In Subform If Value Filled In
Mar 19, 2015
I created a subform in side a form where I have some data. The idea is to fill in the row with a color if a value is met, like "Reset".Conditional format is working (for one field), but in Access 2003 I can only have 3, and I have like 6 values to choose from.I use the below code to no avail:
Code:
Option Compare Database
Private Sub Form_AfterUpdate()
If Me.Legend = "Reset" Then
Me.Legend.BackColor = vbRed
End If
End Sub
I haven't programmed using Access in about 10 years and seem to have lost all knowledge of it.I'm struggling to make a really simple application. I need to keep track of which serial number is attached to which order.All I want is for me to be able to scan a barcode (or manually type the numbers) into a 'packschein' (packing list) and then to scan all the barcodes of the products' serial numbers relating to this packing list. Then preferably simply press the enter button or even better scan a barcode which launches the code to save the new entry.
So a packing list can have 1 or more serial numbers.However, the way I've set it up, for some reason it requires a packschein number (good), but then does not require a serial number. I have this feeling I messed up with the way the tables are meant to be linking to one another.
1. I have a switchboard. I want to click a button, that opens a form with a dropdown list, when I make my selection, it opens a subform in add mode, but the linked field in the subform isn't empty, but filled with the mainform's field value that I selected?
OR
2. Is there a way for me to open a form in add mode, add data to it, click the add button (I will add an add button) that allows me to add again, but this time a particular field is not empty, but filled with selected info from previous selection?
Say for instance, I have 2 fields (both combo box fields), I click add, made selections for both fields, I click add again, but this time one of the fields stays constant like it's already been selected. It's filled with what was selected from before.
I try to create an error message if a user fills in a date field and leaves a combo box with wrong value.I have no clue how to use "Is Not" to check the combo box.The date field that will be filled in is called "Sent to Check" and the combo box is called "Status Case" and the value should be "Sent For Check" If the value in the combo box is different, then the back ground should change to red and get a message.This is the code I have so far that does not work:
Code: Private Sub Test__date_started__AfterUpdate() 'XXXXXXXXXX working onXXXXXXXXXXXXXX If Not IsNull(Me.[Sent_To_Check] And Me.[Status_Case] IsNot "Sent For Check" Then MsgBox "Status Case be set to Sent For Check!", , "Incomplete Form!" Me.[Sent_To_Check].BackColor = RGB(255, 0, 0) Else Me.[Sent_To_Check].BackColor = RGB(255, 255, 255) End If End Sub
I have a problem when I close a form to stop it from closing if a date is not filled in.
If the field "Case_Status" is filled in with "response received" and the date field "response_received_date" is blank, it shows a message and fils in the text box with red background.
It simply fails to keep the form from closing till the date is filled in. Code I have so far:
Private Sub CloseForm_Click() If Me.Case_Status = "response received" And IsNull(Me.response_received__date_) Then Me.response_received__date.BackColor = RGB(255, 0, 0) MsgBox ("Please fill in manatory fields!!!") DoCmd.CancelEvent Else DoCmd.Close End If End Sub
I have searched everywhere but I cannot find the anwser. I'll try to explane.
I have a table in ma database, to make it easier, let's call it Table1.
Table1: Id,Name,Category
Now, In my form, I wanna see this table. I did it with a list, and that works perfect. Now, I want the next thing to happen: If category = 1, then the backcolor of that record should be yellow If category = 2, then the backcolor of that record should be green.
Now the problem is, how can I get multicoloring in my list? or in a subform?
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
I have a calendar to let the users pick up the days and will be save temporaly in a table to print but i only can display the current mouth in calendar, went the user change the mouth the color of the boxes change to normal,in attache i send the BD, In resume, the users select the days in calendar and went change from one mounth to another the days picked stay with color.URL...
I have a problem with seting up color for my pivot chart. First I set up color I want(pic 1).but then when I use filter for End Customer all the colors will revert back to default settings (pic2).Is there a way how to force it so it sticks with colors I chose? VBA code?
I have some code to check a combo box if a date field is filled in, then the combo box can't be empty.I can make the error message appear, but the combo box does not want to change color and it does not recognize any other than value..This is the code that I have, and it does not work like I wish it could.(I took the database over from some one else and need to make improvements on it. the field names where not created by me).
Code: Private Sub cmbCurrentStatus_AfterUpdate() '<<<<<<<<<<<<<<<< Working on >>>>>>>>>>>>> If IsNull(Me.[STEP 1 4 check current status]) And Not IsNull(Me.[Checked__date_]) Then MsgBox "Checked (date) can't be empty if Current Status is filled in!", , "Incomplete Form!" Me.[STEP 1 4 check current status].Value = RGB(255, 0, 0) Else Me.[STEP 1 4 check current status].BackColor = RGB(255, 255, 255) End If End Sub
We have a navigation page with 5 tabs and several navigation buttons underneath their respective tabs linking to reports.
In the main part of the navigation page we have 17 search parameters (text boxes and combo boxes)that the user can use to sort through all the reports we have in the different tabs.
What we would like to do is to have the label text to change to "red" if one of the 17 fields are "required", remain "black" if it is included in the report but not a mandatory search parameter, or turn "light grey" if that parameter is not included in that report.
For example:
My search parameters are: people, phone, and cars
If I were looking at a report of people that included addresses, phones, etc...name and phone would be required search parameters. However, even though I can search by car, it is not in this particular report and the label text should be greyed out. (If the actual text box could go inactive that would be even better).
I have read about buttons being turned colors based on a drop down box choice, but I have not been able to find anything about using a navigation tab subform button to make the colors change in the main navigation form.
I am attempting to adjust the font color of a date field on a report based on the value of two other fields. I have the below code set in the "On Format" property of my detail section - however it does not work when I open the report to view.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer) If Me.Frequency = "Annually" Then If Me.ClassDate < (DateAdd("yyyy", -1, Date)) Then Me.ClassDate.ForeColor = vbRed Me.ClassDate.FontBold End If End If End Sub
how to change background color of MSAccess Reports using VBA? How can I do border coloring. What are the vba codes for all color options like light green, light blue etc. How to change the font type to bold etc using vbaI did some changes to text box coloring in Detail Section on format click event.
I'm using Access 2010. I'm passing a string into the OpenArgs of my report - works fine. In the report there are 3 rich text fields which may contain the text I passed in, and if so I want to change the color of that text to red so it stands out.
The value passed to the report changes so I'll need to use VBA in the detail's format section to check each of the 3 rich text fields.
I have pop up form for report selection. In my drop down i have certain reports that need to have start and end date.
I'm using this formula to show or hide start date field and end date field.
If Not [Report_Selection] = "VehiclesNotRecovered" Then StartDate.Visible = True EndDate.Visible = True
Else StartDate.Visible = False EndDate.Visible = False End If
I would like to give the user a pop message to warn him/her fill in the start and end date field when selecting reports other than VehiclesNotRecovered.
If startdate and enddate fields not filled in and they run a report - they will get an #error message.
I am working on a scheduling form that uses 3 combo boxes to select the people being scheduled. The form is rowsourced to a table of training sessions with a field for each of three crew positions being trained. One combo box is used for each of those fields. The row source for each combo box is a query that returns a list of people due for training, not on vacation that date, correct crew position, etc.
The problem is this: I want to eliminate the people already sceduled in prior sessions from the list. I've tried to put a "not" criteria on the rowsource query but that did not work.
I've been away from Access for a few years but I vaugely remember problems of putting criteria on the field you are filling. Anyone have any ideas?
I have a form with datasheet view and I need to make user that user fills in all fields before he moves on to the next row. how to catch the moment of moving to another row?
One of the managers has requested to set up a form to enter the date at the top of the form and then enter in data for all the plants below for that day. I thought I could just use a form/subform combo with the date (and any other information repeated to all the plants), but the catch is, he wants a list of the plants to automatically populate when he enters a date.
The table would look something like this:
Form
Date
---------------------------------------
Subform (with all Plant names pre-filled for this date -- same list each time--and allowing him to fill in Sales and On Time Delivery).
Plant___________Sales_________On Time Delivery Indianapolis Detroit Memphis Tampa
I have a form that allows users to input data into a field called "Checked out". I was wondering how I can create a report that shows the forms (I have about a couple thousand) only with the "checked out" field filled in.