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 Replies


ADVERTISEMENT

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

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

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

Help In Changing Number Value To Text On Report Of Combo Box....

Feb 15, 2008

I am using a combo box to enter Employees names for training hours...I want to use a pivotchart but when i use the training hours table/form the pivotchart gives me the combo box numbers instead of the names. I know there is a formula or something I am suppose to use here or even a query but I don't have a clue as to how to do this....if someone would be so kind in directing me with instructions and help...thanks
:confused:

View 4 Replies View Related

Combo Box Rowsource Problem

Nov 20, 2006

Hi

I have a combo box on a form for which I want the available values to be a subset of the values from a table (which I can do), but for older records, I want the combo box to be able to display any value from this table.

(The combo is to select a member of staff who has been assigned to a case, and I only want current members of staff to be available for new records, but want to be able to display older records which relate to members of staff who have now left.)

The only way I can think of doing this is to have LimitToList = False, but that defeats the object of having the drop-down list in the first place.

Can anybody suggest a way of doing this please? I can get round it by having a text box AND a combo box, but wondered if there was a way to do it with a single control.

Dave
Salisbury UK

View 2 Replies View Related

Updating A Combo Box RowSource

Sep 30, 2005

I have a form that has both a Make and Model field and I am trying to set it up so that when the Make is selected or changed the Model Query filter updates.

I have read other threads regarding this matter but am still unable to get it to work. The Form pulls from one table (tblPCInfo) while the query pulls form another (tlkpProductsServer). Also the cmoMake ComboBox pulls from table (tlkpProductsCategoryServer)

Model Query:
SELECT tlkpProductsServer.ProductID, tlkpProductsServer.ProductName, tlkpProductsServer.ProductCategoryID
FROM tlkpProductsServer
ORDER BY tlkpProductsServer.ProductName;

I want to add a WHERE parameter to filter for the current ProductCategoryID which comes from what is selected in the Make Combo Box

Code I have Tried:
Private Sub cmoMake_AfterUpdate()
Dim strRowSource As String
strRowSource = "SELECT qry_Model.ProductName FROM qry_Model WHERE qry_Model.ProductCategoryID=frm_frmPCInfo.cmoMake"
Me.cmoModel.RowSource = strRowSource
End Sub

I am not sure if this is enough info to go with and I just started learning VBA so I know this is probably a mess.

View 8 Replies View Related

Forms :: Changing Row Color Depending On Value Of A Field?

Sep 24, 2013

I have this code that should change backgroundcolor in multiple items form based on a value of a field:

Private Sub Form_Current()
'check if field on form called somefield is DVD
If Me.TYPE.Value = "DVD" Then
Detail.BackColor = vbRed 'DVD
Else
Detail.BackColor = 16777215 'BOOK
End If
End Sub

But it does not work, what can I do?

View 1 Replies View Related

Forms :: How To Get RowSource For Combo Box Based On Value Of Different Object

Sep 9, 2013

I have a form with several objects:

Projects -> which have Sources -> which have SourceTypes

The underlying DB has tables for Projects, Sources and SourceTypes:

Code:
Table Projects;
Fields:
ProjectID : AutoNumber;
etc, etc

[Code] ....

So, I'm trying to get all the Sources for a given ProjectID, and I'm using the following SQL statement:

Code:
SELECT ID, ProjectID, Sequence, Name from Sources WHERE [Sources].ProjectID= MyProject.ProjectID;

Which actually gets coded (because MyProject.ProjectID is a variable) as:

"SELECT ID, ProjectID, Sequence, Name from Sources WHERE [Sources].ProjectID= " & MyProject.ProjectID & ";"

What actually happens is that Access jumps in and says (via a Message Box) "Give me a value for Source.ProjectID.

I've just done that in the SQL statement!

How do I get a 'real' SELECT to work for the RowSource?

View 5 Replies View Related

Modules & VBA :: Using Unbound Dropdown / Text Boxes To Narrow RowSource

Jul 17, 2013

I'm developing a form to link a clause to one of a selection of internal documents from drop down boxes (of which there are a lot and hence looking for ways to make it more manageable to find).Now the setup of the internal documents is unfortunately beyond my control (separate SharePoint Libraries, inconsistent fields, you name it they've picked the worst way to do it :P).

I figure the best way to do this is to set up some unbound controls - two drop down (to narrow down location/department), two text boxes (doc code and name) with the idea that it will limit the selection to anything 'like' what is typed in.What I would like is either: How to set the RowSource criteria to only apply if the relevant control is not blank (i.e. if all the boxes are blank, all docs will show; if 'Sales' is selected in department and the user types 'Sales Order Entry' only the Sales Documents relating to order entry will appear)How to add criteria to the RowSource of a dropdown box via VBA (I've created the relevant 'If then ... else' statements but not sure how to add rowsource criteria in VBA)

View 2 Replies View Related

Forms :: Populate Combo Boxes With Values Depending On Selected Value In Previous Combo Box

Aug 5, 2013

I have several comboboxes (6) on my form.How to populate these comboboxes with values depending on selected value in previous combobox.

Example.Lets say that you select value "Audi" in combobox 1, then available values in combobox 2 should be "A4","A6","TT" etc. and if you selected "BMW" in combobox 1, then available values in combobox 2 should be "3-series", "5-series" etc...

View 1 Replies View Related

Forms :: Changing Multiple Text Boxes To Combo Boxes?

Mar 14, 2014

there is a way to convert multiple text boxes to combo boxes all at once, rather than right clicking on them one at a time, and selecting Change to.

I have a form with about 50 fields and most of them need to be converted to combo boxes. I'd always done it manually one at a time up to this point, but I'm trying to build up my learning and look for smarter ways to do things.

View 4 Replies View Related

Display Picture Depending On Combo Box.

Dec 14, 2006

Hi all! i am wanting to display a signature (jpeg image) when a combo box is displaying "Yes" and the picture to be hidden when the combo box is either empty or set as "No". i have before managed to change colours of other fields depending on combo boxes - but my coding isnt that great, so i dunno what code is req'd!all help much appriciated!thanksDave

View 4 Replies View Related

Change Photo Depending On Combo Box Value

May 29, 2013

I have a log in form and combo box.

Just want to ask if possible to change photo depends on combo box value?

Here is the link of my database. [URL] ....

View 3 Replies View Related

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 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

Using 2 Combo Boxes - 2nd One List Depending On Selection In First

Sep 23, 2005

(pls see end of thread for further clarification)

Hi

I am trying to achieve the following using 2 combo boxes

Box "a" is a list of courses from tbl_training_courses. The user selects the appropriate course.

Box "b" is a list of dates for each course from tbl_course_dates. Thus the user can select which date per course they want to book someone onto, and this value is then stored in tbl_training_record as the date the person is booked onto.

Its not working!!! It either displays blank values, or it starts a parameter query which I didnt want.

In the combo wizard, access refers to "remembering the value selected for later use" - i guess this might be what I need to use, remembering the value from the first and using it to select rows for the 2nd box based on identical courseID - but I can't seem to find this in Help file.

Any ideas anyone?

View 6 Replies View Related

Need A Combo Box To Display Different Lists Depending On A Control

Dec 1, 2005

Hi, I'm not sure how to write something and would like assistance. The form is taken from a table and then there are two diffenterent forms displayed as datasheets within, on tab controls. I have a combo box taken from a query on each form and would like the combo box to display a certain list if the control on the form (the bit taken from the table) has a P in it, a different list if the control has an R in it or to display the whole list if the control has a B in it. Trouble is, I'm quite new to this and I'm not sure on how to write any code for if statements or whatever is needed. If you are able to assist I would appreciate it. Thanks

View 1 Replies View Related

List Box Populated Depending On Combo Box Selection

Feb 1, 2006

I have quite a simple problem I think, but i don't know if I'm able to explain it properly.

I have three tables:

one for contacts
one for the groups contacts are a member of
and a junction table to solve the many to many relationship there.

What I want, is to create a form, with a combo box with a drop down list of groups. When a user selects a group, I'd like all the contacts (including *some* of their fields) to populate the list box below.

So a user can easily view the members of each group.

Does that make sense?

View 6 Replies View Related

Combo Box Contents Depending On Prior Combobox

Aug 31, 2006

Hi

I have a form that is basically an autoform for inputting into my main table. I have one combobox that has customers in it.. let's call them a b and c. Further down is another field, called Reference. Each customer can have certain references. I want the reference field to be a combobox, in which the selection list is dependent on the choice in the customer combobox.

So if customer is a, the ref. cbo gives you the choice of 1, 2, or 3. If Customer is b, ref is 4, 5, or 6, and if customer is c, ref is 7, 8, or 9. See what I'm saying?

Sorry if it's not explained very well, I am happy to answer any questions to clarify it.

Thanks.

View 1 Replies View Related

Load Record To Form Depending On Value In Combo Box

Oct 10, 2007

Hey,
I have 2 combo boxes. The first one gives a lis of Prefix letters for railcars. The second uses the value of the 1st and finds railcars that start with the same letters.

finally got the 2nd combo box to list the prefix and number of a railcar based on the 1st combo box and also got it to clear as each run-through starts.

Now that the user can select a number (ex. dfcv1234 as the railcar), I need to find the record with the prefix dfcv and the car number 1234 and load the record to the form for view and editing.

So far, I know it needs to be the after update event and have a select statement that finds the [key], [prefix], [car_number] that matches the value selected on the form but how do I use the key to make the record show on the form?

Thanks,
slh

View 5 Replies View Related

General :: Change Photo Depending On Combo Box Value?

May 29, 2013

I have a log in form and user combo box.

I want to add photo of each user in this log-in form.

Just want to ask if possible to change photo depends on combo box value?

View 1 Replies View Related

Forms :: Change Field Depending On Combo Box

Mar 18, 2014

In the database, there is a table called "Jobs" which sales enquiries are entered into. In this table, there are fields called "JobStatus" which has the default text of "Quotation Pending" and a combo box "JobLive" which is a "yes/no" field. Normally a job will come in as quotation request and the "JobsLive" field will be set to "no".

Occasionally, a job will come in as confirmed from the outset. In this case, the job will be marked as "live" in the combo box "JobLive". Is it possible to change the "JobStatus" field to "Job Live" when this combo box is changed to "yes"?At any other stage, the "JobStatus" field will be changed using an update query as and when changes are made.

View 11 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

How Do I Display Certain Records Depending On The Option Chosen In A Combo Box

Aug 2, 2005

Hi I'm a real newbie at this but basically I have a form displaying three lots of contacts Expediting, Quotation & Miscellaneous contacts.After choosing the company name from a list box it displays the Expediting, Quotation & Miscellaneous contacts info - but doing it this way there isnt much space on the screen to show all the Contact names,Telephone fax & email addresses clearly& at a decent size.Apart from the company list box I want to have a list box/combo box with:

Expediting
Quotation
Miscellaneous

and then after choosing Expediting, Quotation or Miscellaneous from the list/combobox i want it to take the relevant data from the Expediting, Quotation, or Miscellaneous contacts sections and only display the information relating to those sections only, therefore allowing me to have bigger text and not so cramped display so everyone can read it ok and get more info on the screen for each contact group.

If anyone could help it would be much appreciated!!!! Thankyou in advance for any help. Be gentle with me I am a newbie,lol.

Thanks again

View 2 Replies View Related







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