The Selected Value Displayed In A Combobox
Apr 29, 2005
I'm sure this is simple and I'm just missing something...
I have a combo with two columns and the row source set up as a query which returns two columns.
When I click the drop-down arrow for the combo box, I get exactly what I expect.
What I want to do is initialize the combo box so that the "default" selection is displayed in the "text" or "value" section of the box. I also want to be able to update this when the user makes a selection.
I have no problems when using a list box with something like:
listbox.value = <Some Index in the listbox>
With the combo box, I've tried:
combobox.text = xxx
combobox.value = xxx
combobox.column = xxx
combobox.itemdata = xxx
combobox.listindex = xxx
The value property sort of works -- It displays the data from the first column right justified in the "text" section of the combo box. I need to have both columns displayed the way they are when the combobox is dropped down.
Any thoughts?
Thanks in advance...
View Replies
ADVERTISEMENT
Apr 26, 2015
I am trying to use a combobox called Manufacturer to select which table the combobox called Model gets it's rowsource from using the code below.
Code:
Private Sub Manufacturer_AfterUpdate()
If (Me.Manufacturer.Value = "Siemens") Then
Me.Model.RowSourceType = "Table/Query"
Me.Model.Recordset = "SeimensTable"
Me.Model.RowSource = "SELECT Model FROM SeimensTable"
Else
If (Me.Manufacturer.Value = "Samsung") Then
Me.Model.RowSourceType = "Table/Query"
Me.Model.Recordset = "SamsungTable"
Me.Model.RowSource = "SELECT Model FROM SamsungTable"
End If
End If
End Sub
But when I run the form and select Manufacturer. Combobox Model remains empty. tell me what I'm doing wrong?
View 5 Replies
View Related
Oct 6, 2005
I have set up a form which has 2 combos.
Combo A pulls from a query which gets surgery address1, address2, and surgeryID. It displays only the first 2 fields.
Combo B gets info from a query getting staff firstname, surname, title, staffID and surgeryID, and shows the first 3 fields.
I have the following code in the afterupdate of box A (surgery_combo)
Private Sub surgery_combo_AfterUpdate()
staff_combo = 0
staff_combo.Requery
End Sub
HERE IS THE PROBLEM:
The queries seem to work fine, as box B displays the staff that work at each surgery. However on selecting a staff member, you can only SELECT the ones who have a salutation (mr/mrs etc) in the first column. And when you DO select this - the combo shows a most unhelpful "Mr" whereas I want the name there.
How do I change the column that the combo displays once selected?
View 10 Replies
View Related
Jan 19, 2015
I have a combobox which lets you select from a list of pseudonyms. Each pseud belongs to an author; authors can have multiple pseudonyms and exactly one main pseudonym. This is the table structure (picture of relationships attached below):
Code:
tblStory: StoryID (PK), AuthorID (FK), Title, etc.
tblAuthor: AuthorID (composite PK, autonumber), MainPseudID (composite PK)
tblPseud: PseudID (PK, autonumber), Pseud, AuthorID (FK)
The combobox list shows all the pseudonyms and then stores the corresponding AuthorID. At the moment, the pseudonym displayed in the combobox (once a selection has been made) is simply the first alphabetically for that particular author: for instance, if a story has AuthorID = 5, and Author 5 goes by anon, anonymous, and unknown, the combobox for that story will display "anon".
How can I make the main pseudonym (tblAuthor.MainPseudID = tblPseud.PseudID) be displayed instead?
Control source is tblStory.AuthorID
Row source:
Code:
SELECT tblPseud.AuthorID, tblPseud.Pseud, tblAuthor.MainPseudID
FROM (tblAuthor LEFT JOIN tblPseud ON tblAuthor.AuthorID = tblPseud.AuthorID)
LEFT JOIN tblStory ON tblAuthor.AuthorID = tblStory.AuthorID
ORDER BY tblPseud.Pseud;
View 1 Replies
View Related
Nov 4, 2014
I am designing a Web Database with a bound form to a submit table.
On the form, I have a combo box with selections that should influence the value to be displayed in a textbox also on same form.
For instance the combo box for Staff Name contains list of all Staff and I want the textbox to automatically display the level of the staff that was just selected in the combobox.
I know how to get this done using a combobox but my boss insists that the level should be automatically displayed in the textbox once combobox selection is done.
Using the combobox for level, I used the select statement in the RowSource property :
SELECT Staff_List.Level, Staff_List.Staff_Name FROM Staff_List WHERE (((Staff_List.Staff_Name)=[forms]![frmtest]![cboStaffName]));
I am in a dilemma of how to replicate this for the textbox because textbox only has control source and no RowSource where I can put this select statement.
Also, I will still need to bind this textbox to the submit table with the column name "TxtLevel" in the control source
Please see attached sample access db.
Also note that I cannot use action queries or VBA because it is a Web database and not a client database.
View 1 Replies
View Related
Mar 1, 2007
Greetings all, am in the middle of learning vb.net and have just been thrown in the deep end of Access as a concequence lol.
There is more to it, but the core of the problem is this:
imagine a form - on this form is a combobox and a button
the combobox displays the result of a query in its drop down section, and once a record is selected it is displayed in the text area of the box - no problems so far
the button has a function by which an additional record (the currently displayed one) is moved into the afore mentioned combo box from another. again this works just fine.
what i want to do is (i think) query the result of the query on the combobox to find the record within that query which matches the currently displayed record and then set that result = combobox.selected
oh and to make matters worse i have no idea how to write a query from scratch in VB wthout use of a wizard <sigh>
help anyone?
View 1 Replies
View Related
Nov 1, 2014
i have 2 tables (clients, frequencies) where in table "clients" i have a column to store ID of "frequencies" table (id, description).
in my form "FClient" i display data stored in table "clients" and i have a combobox that should display the "frequencies" descriptions, but with a frequency selected by default...in fact the one that has its ID stored in table "clients". i'm able to display all frequencies descriptions but i don't know how to easily select and then display, as default, the frequency stored in table "client"
View 3 Replies
View Related
Mar 30, 2015
How can I remove an item after being selected from a combobox ?
View 2 Replies
View Related
Sep 15, 2011
I am new to access. I have the following code to lookup associated fields with a CourseNumber that is selected from a combobox. The information is then stored in a CourseEnrollment table linked to student info.
The CourseNumber and associated fields are located in a LU_CoursesOffered table. The LU_Courses Offered table has been populated by choosing associated data from combo boxes based on other LU tables.
I am getting the primary keys returned for the associated data rather than the text stored with that key.
Private Sub Combo103_AfterUpdate()
CourseName = DLookup("CourseName", "LU_CoursesOffered", "CollegCourseNum = " & Nz([CollegeCourseNum], 0))
LevelSection = DLookup("LevelSection", "LU_CoursesOffered", "CollegeCourseNum = " & Nz([CollegeCourseNum], 0))
AcadGrad = DLookup("AcadGrad", "LU_CoursesOffered", "CollegeCourseNum = " & Nz([CollegeCourseNum], 0))
Instructor = DLookup("Instructor", "LU_CoursesOffered", "CollegeCourseNum = " & Nz([CollegeCourseNum], 0))
End Sub
View 3 Replies
View Related
May 19, 2013
I have a table, Registration, with 8 fields:
inschrijvingsid,name,gemeente,gsm,telefoon,email,a ankomst,gerecht,personen
I have another table, Login with 3 fields : Naamid,name,,status
Then I have a combox that is connected with fldname from the table Login.
In that form I have 8 textboxes:
name,
gemeente,
gsm,
telefoon,
email,
aankomst,
gerecht,
personen
And status.
Now what I can't. I want when I select a record from tblLogin Like for example Daan that I see in the textboxes his info from the tableRegistration.
Also when I change the textbox Status it and click "Verander status" it changes in the database.
View 3 Replies
View Related
Oct 2, 2013
I have a split form that was not made by wizard. On the form part I have a combobox that is unbound to the form data set. The combobox has a query row source that is based on the current row selected. I want the combobox to have an up-to-date result based on which row is selected.
If I set the combobox to requery in the form_current event then I get what I want. I don't want to put up with the little delay that is generated every time a user changes rows because of the requery, though. I only want the requery to happen when they use the drop-down menu.
I have the requery in the gotfocus event of the combobox on the form. I mostly get what I want this way, however if they select an item in the drop-down list, then choose a new record in the datasheet, then try to use the combobox again, the combobox is not refreshed (because it never lost focus?).
To get around this, I've tried to setfocus to something on the form in the on_current event, but access gives me an error: 'Access can't move focus to the control btn_Refresh'.How can I get the combo to requery only when users are about to use it?
View 4 Replies
View Related
Apr 1, 2013
I have a suppliers table and a products table. Two forms, Stock form with combobox to list Suppliers and a sub form with combobox that lists Products.I want to select a supplier from the Stock form and then the combobox in the subform to only list products directly sold by the Supplier.Have dabbled in SQL as follows:
SELECT Products.ProductID, Products.ProductName
FROM Suppliers INNER JOIN Products ON Suppliers.SupplierID = Products.SupplierID
WHERE ((Stocksubform.SupplierID=Stock.SupplierID))
ORDER BY Products.ProductName;
View 2 Replies
View Related
Jul 11, 2013
I am still trying to get a hang of development in access 2010.
I would like to design a form with a listbox or a combobox which holds all 8 of my reports (a table has all the reports), with a Print and a Preview view buttons. In addition, the user must be able to select if they want to view the report by month, quarter and the year in question.
How do i have a specific report print or previewed based on the value selected in the listbox or combobox and the date criteria.
View 4 Replies
View Related
Jan 13, 2005
How would I modify multiple comboboxes in subforms at the same time. For example.. In main form ComboboxA user selects 1992, Combobox1 in subform1 is also changed to 1992, as well as Combobox2 in subform 2.
Whats the best way to do this?
View 2 Replies
View Related
Apr 22, 2005
I have 2 comboboxes, the first one is called "activity", whereby I have 3 options to choose from, and the second is called "level".
When I click an "activity", for example Drawings, I want the "level" combobox to list a unique set of options for that category. and if I click on a different "activity" for example Planning, I want the "level" combobox to show a completely different set of options.
If anyone can give me any help on how to do this then I would be very grateful!!
Thanks
Angela :eek:
View 2 Replies
View Related
Jun 28, 2005
Hi guys,
Bit of a problem I'm hoping someone can help with. I have a telephone call logging system. The system is a tabbed form with each tab representing a person's Telephone Call Inbox. As new calls are entered into the database, they appear in each person's inbox until they are marked as dealt with.
This all works fine and there are no problems with the basics of it, but the problem I do have is that after I have split the database into a Back end and a Front end and distributed the Front ends to each user, when a new call is entered it doesn't appear in the persons inbox until they do a requery.
At first I sent the form to requery using the ontimer event, but the problem I have is that after every reqery the form goes back to the first record. A user on the office forum suggested I use the following code:
vCurrent = Me.Bookmark
Me.Requery
Me.Bookmark = vCurrent
But this gives me invalid bookmark errors, so I was then told to add
On Error Resume Next
But this stops the bookmark function working and instead the first record is loaded every 1 minute (as set by my timer).
Can anyone recommend a better way that actually works without invalid bookmark errors?
View 14 Replies
View Related
Mar 4, 2014
Whenever I use a look up field to enter values, I get the ID number displayed instead of the value (name). How do I rectify this error.
View 2 Replies
View Related
Jan 28, 2008
Hi,
I have a order system which allows customers to place items on. When an item is selected and a quantity has been entered and add button is selected, this adds the item into a listbox with all the details.
Each item that is selected a quantity is selected, this would then work out a total price and this total would be displayd within the list box too.
i want to add all the totals up for that order and have it displayed within a text box.
for example:
product ID, Name, quantiy, item price, totalcost
P0001 Top 5 1.00 5.00
P0002 Top 4 2.00 8.00
P0003 Top 3 1.00 3.00
i then have a text box where i want to display the overall total for these items within. hope this helps. im really stuck on this one!!!
View 4 Replies
View Related
Apr 8, 2008
Hello,
I have a querie that calculates the average of two sets of times taken from a calculated figure in a table.
My problem is that the returned value seen when the querie is ran needs to be of a clock format. Eg 0.75 needs to read as 0:45
I have attached a Database to help, as i am unable to do this.
Any suggestions given i am greatful for.
View 3 Replies
View Related
Aug 1, 2005
Hi,
I am trying to choose an entry from a COmbo Box which ahas a Lookuop underlying in it. I then want to display the additonal four entries in the form it self. The data is already created and displayed in a query. The primary key gets displayed but thte other data cannot be displayed. Is there any way I can display the other details eg: Firstname, Surname Age in the same form but under different fieldnames. I am not sure how to do this.
I could retype it all in but that is uneconomical. Any ideas? Please help.
Thanks.
View 2 Replies
View Related
Dec 2, 2004
New to Access - I have a database which currently has 200 records. When I run a query or report it's the 150th Record which comes up first. I do get all the information but would like to know how I set it up that it's the 1st record which is taken first and then so on.....
View 1 Replies
View Related
Dec 22, 2004
When I view data in linked tables in MS Access containing foreign characters (umlauts, accents, etc), the foreign characters are not being displayed properly. It is not a font or Access setting because I am using a separate similar database (also containing linked tables) where the foreign characters are being properly displayed.
Is there a setting I'm missing in the linking of the tables? Not sure where else to check.
View 1 Replies
View Related
Sep 8, 2006
I have successfully used an Expr code in my query to get the calculated result that I need. My problem is I can't seem to display the results on a form. I get the error "Name?"
When I try to find the query on data control which I used, it does nothing but shows me the fields from my table. How can I get a query expr column to display in my form?
the name of the query is "together" and the column's name is "everyone"
Can someone please point me in the right direction
View 2 Replies
View Related
Jul 31, 2013
i want to make it equal to my forms adjusted width but i don't know how to do that. Also i thought it would look like a form enwrapped within a rectangle or a square yet its gluded onto Access with no border
View 2 Replies
View Related
Nov 11, 2012
I have two tables, [ATWelding] and [Results] . They are linked as they both have Weld ID.I want query to show any ATWeld ID that doesnt match a Weld ID in [Results].I can't use SQL as my database is on the web compatible platform. I attempted to do this using InStr([Results]![Weld ID]) in my Weld ID ATWelding criteria on a query but as I am using the web version an error message saying the expression is not compatible with the web is being displayed. I can run the query in my web database?
View 2 Replies
View Related
Jan 25, 2006
I've tried searching the forums and haven't found quite what i'm looking for. I would like to be able to change the source for a combobox based on another combobox. The simplest way i can summarize that is i want to be able to choose A or B, depending on my choice i want another combobox to display all the values that A or B can have.
Thanks
Jim
I'm not sure I worded that very well. :(
View 1 Replies
View Related