Alter Text Colour Depending On Value

May 24, 2006

Hi,

I am building a stock control database. I have a form called [products]. On this form are two fields. One called [ProdReorder], the other [UnitsOnHand].

[UnitsOnHand] is displayed form a subform called [ProductsSubform].

What I want to know is: What code would I enter (& where) so if the [UnitsOnHand] value is less than the [ProdReorder] value it will display the value in red?

Eg: Reorder value is 5
I have 10 motors on stock (UnitsOnHand) = Text is black.
If I have 4 motors on stock = Text is Red.

How can this be done? any advice welcome. PS. my vba skills are weak.

View Replies


ADVERTISEMENT

Auto Colour Change Depending On Text Selected

May 5, 2005

:) Hello

Is it possible to change the colour of the text in a table. For example the word "URGENT" is selected from a combo box, and when viewed in the table it appears red.

Thanks inancipiation

Woozie

View 1 Replies View Related

Change The Colour Of A TextBox / Field Depending On It's Value?

Jun 7, 2006

Hello fellow programmers, I have a tricky one for you. We have decided to split our local City up into different zones. Giving each zone a number and assigning it a colour. I have a form with all the customers who want jobs done in different parts of the city. This form has a text box on it called: Zone - (which has a 3 digit number it it). I want the colour of the text box to change depending on the Zone number, in the continuous Form view. So all the customers living in Zone=111, will have a Red background colour (color), all living in Zone=222 will have a Green background colour. I know conditional formatting through the properties of the Form can be used, but it only allows me to select 3 different situations. I have many more than 3 colours that I want to assign. I am working on a VB module to define what colour numbers from the MS Access Colour Map will be assigned to each Zone number. How can I now apply this module to the form, so when it opens, all the customers who live in Zone=111 will have a Red coloured background, those living in Zone=222 will have a green colour background, etc?

View 9 Replies View Related

Change Text Colour

Feb 8, 2006

Friends,

I would like some help with my form.

I would like the following:

If txtname is null (without data), then txtdob font is changed to colour white.

Any help?

Thanks.

View 1 Replies View Related

Changing Text Colour Of Labels On Activate

Nov 23, 2005

Hi, im working on my school project for A2.

When the user clicks on say; the customer ID dropdown menu, i want the label text on the right of it to get darker (make it more visible). How can i do this?

(i have attached a picture of my form)

thanks, Robin

View 2 Replies View Related

Changing Command Button Text Colour.

Jun 30, 2006

Hi all,

I'd like to change the colour of the text in a command button when the user click the button, but for the text to return to it's original colour when the botton pops back up.

I'm assuming you use the following commands:


Private Sub cmdClose_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
*******CODE********
End Sub

Private Sub cmdClose_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
*******CODE********
End Sub


But I'm not sure as to how I would enter the correct code.

Any help would be appreciated,

Best Regards,

Aaron

View 2 Replies View Related

Modules & VBA :: How To Update Text Box Depending On Value

Mar 30, 2014

right I have auditing system in my database that tracks any changes made to any records. it logs it on a separate table and i show it on a continuous form.

right my problem is that I have loads of check boxes and text boxes on my main form on the form that records the main form I have a field call "new value" this is a text box but if I change a checkbox on the main form it will show -1 or 0 in the new value field on the recording form but I would like it to say yes or no I have tried the following

Code:

Private Sub New_Value_AfterUpdate()
If [New_Value].Value = -1 Then
[New_Value].Value = "yes"
End If
End Sub

this only works if I enter -1 manually but the data is entered automatically after the record is saved on the main form ...

I have also tried on enter before update I get error but now I need it to change on new entry...

View 8 Replies View Related

Changing Rowsource In A Combo Box Depending On The Text In Another

Jul 10, 2007

Hi all,
I am trying to have the rowsource change on a "subcategory" combo box depending on what the "category" combo box says.

I added an event procedure to the "Category" combo box which changes the Row Source in the subcategory combo box to something else. I'm not sure that I did this right as if I close the database and reopen it, what I selected in the subcategory combobox is gone and it is blank. Any ideas? Here is my simple, likely incorrect event procedure:

Private Sub Category_Change()

If Category.Text = "Rare Books" Then
SubCat.RowSource = "scRareBooks"

End If

If Category.Text = "Legal Documents" Then
SubCat.RowSource = "scLegalDocuments"

End If


End Sub

Thanks!

View 5 Replies View Related

Text Field Update Depending On List Box Value

Aug 19, 2005

I realize there are several threads already dedicated to this particular topic but my situation is slightly different... First, my tables are set up like so:

tblStudent(studentID,LName,FName,MI,Gender)
tblRack(rackID,roomID,studentID,rackNumber)
tblRooms(roomID,roomNumber)

There are 3 racks to a room and a total of 90 rooms. A room can hold up to 3 students. A list box holds values that I have typed in (the room numbers). I went with typing them in rather than pulling them from a query because of the way my tables are set up. If I pull from a query as the tables stand, room numbers show up 3 times, once for each rack. I want to be able to fill in text boxes with information on students assigned to the room I choose from my list box (FName, LName, etc...) I'm kind of at a loss here on how to go about getting the info that I want. Using the column property to populate text fields is probably going to be much easier but a query is needed (I think) and using a query causes room numbers to show up 3 times in my list box... Anyone want to throw me a bone?? Thanks! :)

View 2 Replies View Related

Editing A Specific Text Box Depending On A Number

May 2, 2013

I want to edit a specific textbox depending on a number which is dependent on a number of things and varies each time the form is run.For example, if the number is 0 I want to edit tb0.value. If it's 1 I want to edit tb1.value etc. I have specifically labelled my text boxes in this way.I thought something like this would work

textBoxName = "tb" & number
textBoxName.value = "this is the value I want to enter".

However, this does not work and it produces an error saying 'Invalid Qualifier'.

View 3 Replies View Related

Forms :: Changing Border Of Text Box Depending On Value Of Field

Jan 9, 2014

I have a box with age in called [agecalc]. I want to change the border of the box to red to indicate they are a Juvenile if under the age of 17.I already have some code to write the text, I just need to change the border of this text box called agebox

=IIf([agecalc]<=17,"Juvenile!!")

View 1 Replies View Related

Modules & VBA :: Display Text Depending On Combo Box In Different Form

Aug 6, 2013

I want to display the text from one combo in a text box in another form based on what's selected in a second combo box. The text box is in a different form from the combo boxes.

Sub D_ComponentTypeCmb_Change()

If Me.D_ComponentNameCmb.Value = "Customise" Then
Forms!CustomComponentF!C_ComponentTxt.Value = Me.D_ComponentTypeCmb
Else
Forms!CustomComponentF!C_ComponentTxt.Value = ""
End If
End Sub

View 13 Replies View Related

Reports :: How To Make Label Visible Depending On Text Box Value

Jul 27, 2014

I have a report that displays on a continuous style report. What courses the employee have been on and when they expire

right I have field call expirydate and another call dayover showing the number of days till that course has expired also I have made a label called Expired1

now what I'm trying to do.....

if the expirydate has passed I want the expired1 label to be visible and dayover field to become invisible

I have tried

Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.Expirydate < Date Then
Me.expired1.Visible = True
Me.DaysOver.Visible = False
End If
If Me.Expirydate > Date Then
Me.expired1.Value = False
Me.DaysOver.Value = True
End If

I have also tried the code on current event on the report

now my problem if one of the course has expired it will show the label called Expired1 but on all the records but I only want it to display on the record that has expired and leave the daysover text box visible if course has not expired

View 7 Replies View Related

Forms :: Text Box Background Color Depending On Its Value In Continuous Form

Jul 13, 2013

In Access 2007 (or 2010 , 2013), in a continuous form, I want to change the background colour of a text box depending on its value. Obviously, for each record, the color can be different.

View 1 Replies View Related

Changing Font Size Of Labels Depending On Text Length

Jul 28, 2014

I have a report that prints labels (similar to avery labels) which pulls data from a query. These labels are all unique and vary in length. Due to the length variance, I want the font size to get smaller for labels with more characters. I want the text to go down to another line when necessary.

In my report under the OnPage Event Procedure I wrote this:

Private Sub Report_Page()
If Len(Text2) > 20 Then Text2.FontSize = 8
If Len(Text2) > 10 And Len(Text2) < 21 Then Text2.FontSize = 10
If Len(Text2) < 11 Then Text2.FontSize = 14
End Sub

This works to some degree but the problem is that once there is a longer label, all of the proceeding labels are resized & the longer label that should have been resized was not.

Is there another place I should be writing this code? I looked under events for the textbox but there doesn't seem to be anything that would work since none of them would trigger when printing labels

View 3 Replies View Related

Alter Autonumber

Sep 27, 2006

if i create 100 records with autonumbers as primary keys (record_id)

then deleted 30 at random

could i update the record ids so they become 1-70?

View 4 Replies View Related

How To Not Allow Users To Alter The Table?

Aug 23, 2007

hi,

i have a raw data table built, may i know how to hide the table to not allow users to alter the raw data table?

I use the Tool > Startup option to hide everything but if the users are clever enough, they would able to make that available and try to alter the raw data table which i want to prevent and hope that's not gonna happen.

View 1 Replies View Related

Alter Date Format With SQL?

Jun 18, 2007

I need to change the format of a date column from Short Date to a custom format. Does anyone know how I can do that with an ALTER TABLE command in SQL? I know how to alter a column and set the data type, I just can't figure out how to set the format for the date.

View 2 Replies View Related

Using Queries To Alter The Structure Of Tables

Aug 2, 2005

How can I add an additional field to a table based on the output of a query? For example, I have table A with 2 types of records and table B with only 1 type of record. Based on this, I can determine which records in table A are the same type as those in table B. I would however like to be able to flag within table A, those records in table A that are the same as those in table B.

View 1 Replies View Related

Setting Property To Yes/no Using Alter Table

Dec 4, 2004

I want to add a column to an existing table using the sql statement Alter table. The new column needs to be a yes/no type. The following code almost works but it only sets the column to a general logical type not specifically the yes/no check box .

DoCmd.RunSQL "Alter Table TblIssues Add [" & Issue & "] logical;"

Any ideas?

View 4 Replies View Related

Error In Alter Table Statment

Feb 1, 2005

"ALTER TABLE MOVIE ADD ( MULTIPLEX NUMBER(3))"

while i'm trying to execute this query ...

Its displayed as 'SYNTAX ERROR IN FIELD DEFINITION'

Pls help me.... :confused:

View 1 Replies View Related

MS Access Alter Data Length

Nov 15, 2006

what would the T-SQL be for changing (altering) the data length of a field programmatically in a table in MS Access?
so if a field had a data length of 50, id like to change this to 60 programmatically. What would the code/syntax be?

View 1 Replies View Related

Alter Table Rename Column

Jul 25, 2005

Hopefully someone can help....

I'm trying to change the name of a column in a table using SQL. I've tried different combinations but always get

"Syntax error in Alter Table statement"

SQL I've tried

alter table tblImport
rename column F1 to [Date];*

alter tblImport
rename column F1 to [Date];

alter table tblImport
rename F1 to [Date];

I've checked this out via some SQL sites & think the first version (*) is correct....can someone throw light on this? I'm using Access2000

View 3 Replies View Related

Automatically Drop And Alter Primary Keys

May 23, 2005

Hi guys
I am trying despereatly to fulfill this function with a macro
any help will be appreciated
I know this may be easy but the help files isnt helpful- so what else is new ;)


Database- C:sports.mbd
table - tblbasketball
current primary key - ID



new primary key needed- ID, EMPNO


The following codes dont work :(

ALTER TABLE tblbasketball
DROP CONSTRAINT PK_tblbasketball PRIMARY KEY

View 1 Replies View Related

ALTER TABLE And SEPARATE DATA SQL STATEMENTS

Jun 7, 2005

Helo…please really need your help.

I designed a small desktop database to automatically import some Log files. A sample of a transmit log file (emails sent from our rural email stations) looks like this when imported in access.

Date Time Direction SenderMessageID
03062005 133501To InternetemailX@ab.comBlablabla
03062005 125001To InternetemailQ@ab.comBlablabla
03062005 125001To InternetemailZ@ab.comBlablabla
03062005 125001To InternetemailA@ab.comBlablabla

I would like to be able to query all emails sent between one date and another. However, the date here is recorded has a string or text. I would like to automatically add a field with the date as Date/Time datatype in the Table. I think I should be able to do this with a few SQL statement like ALTER TABLE myTable ADD COLUMN NewDate AS datetime…and then another SQL statement to separate data and put it into this new field.

Then I could query for BETWEEN Date1 and Date 2 easily.

I’m pretty close but been trying for a while now and always error messages as results. I think I really NEED help this time.

Thank you,

Ghislain Bob Hachey

View 5 Replies View Related

Modules & VBA :: How To Alter Tables In SQL Server From Access

Jul 7, 2015

I have an access front-end package that works just fine but if there is an update, I just want the program to run scripts to update the SQL Server tables that it is connected to. I just don't know how to do this. I know how to do this on SQL Server Management studio and all, I just was hoping I could do it straight from my access front end so that a user could just click a button and update the tables or something.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved