Can You Fill A Text Box Using A Query
Feb 24, 2006
Hi, newbie needs help!
I am trying to make a courses registration database. I have 3 tables; tblContacts [ContactID], [FitstName], [LastName] [Etc..] [Etc..]
tblCourseRegistration [RegID], [ContactID] [CourseID] and tblCourses [CourseID], [RegID], [CourseName], [StartDate], [AvailablePlaces]
I have created a form called Test1 that displays The CourseID, CourseName, StartDate EndDate and an unbound textbox called PlacesLeft. I would like to display in this text box the number of places that are still available on a particular course. I've written a querie that counts the CourseID's in the course registration table this works ok but I want it to place the value in the PlacesLeft text box. Then I can do a simple calculation based on the PlacesAvailable textbox. Anyone any idea how to do this My querie reads
SELECT Count([CourseID])
FROM tblCourseRegistration
WHERE (((tblCourseRegistration.CourseID)=(Forms.Test1.Co urseID)));
I tried another method which includes a command button that when clicked tries to run the following
Dim MyRS As ADODB.Recordset, strSQL As String
Set MyRS = New ADODB.Recordset
strSQL = "SELECT Count([CourseID])FROM tblCourseRegistration WHERE (((tblCourseRegistration.CourseID) = (Forms.Test1.IDNo)))"
MyRS.Open strSQL, CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If MyRS.NoMatch Then
Me.PlacesLeft = ""
Else
Me.PlacesLeft = MyRS.Fields(0)
but Access (Ver 2000) does not like the noMatch and shows it as an error.
I would be very grateful if someone could show me how to sort this out!
Many thanks in advance
View Replies
ADVERTISEMENT
Oct 26, 2006
I know how to base the combo box on a query, and in the after update enter
Me.[txtboxName]= Me.[cboName].Column(1)
BUT...
I want to bound the combo box to a control source.
How can I achieve that?
Thanks~
View 3 Replies
View Related
Jun 14, 2005
ok, here goes...
sorry if this is really simple, i just can't figure out how to explain exactly what i'm trying to do...
first of all, i have a list box populated by a table, when i click my button, i want to create a record in the table (done). then i want to display the id for that record in a text box. this will allow me to update the record, which i have also worked out. i just can't seem to figure out how to display the id from the table.
Thanks for your help
*j
View 4 Replies
View Related
Feb 20, 2006
May I start by saying Hi and that im just embarking on understanding Access 2003. I do know a little about DB as I have built programs in VB6 using databases. But now onto my problem which seems a simple one.
I have a Db called delivery. With columns as below. Mtno being the key.
Mtno Orderno Description Quantity Customer
I populate a combo box with Mtno, but on the click event of the combo box i wish to populate textboxs from the other columns.
Code used.
Private Sub Combo0_Click()
Me!text2 = Combo0.Column(1)
Me!text3 = Combo0.Column(2)
End Sub
text2 gets populated and updates on the click event of the combo box but text3 doesnt. Niether do the other text boxes when I put the code in.
Help me understand this please.
kind Regards
Tony
View 4 Replies
View Related
Dec 5, 2006
Hello I hope someone can help me on this one.
This is something I am not getting an understanding on and need some help.
I made a form that holds all information for our customers.
I want to make the Company Name box into a combo box so when I change the
Company Name in the combo box it populates all the text boxes on the form with
the correct data.
I for the life of me do not know where/how to even start to do this.
I would attach my database but I cant seem to get the file small enough. I have deleted the large table and it is still 7megs. How do I get it small enough to attach it?
Thanks for the help.
View 3 Replies
View Related
Aug 19, 2005
I'm pretty new to this type of programming and i was hoping for a little help,
I have completed the majority of my program it's just a few little things i need to tweak.
The main thing is that i am trying to get a text box to autofill from a selection in a combo box i.e.
i have selected a drop down box with 3 coloums looked up from another table i would like 1 of the columns to stay in the combo box after selection and the other two to appear in the text boxes on the same page.
Any help would be much appreciated.
thanks
Brad
View 6 Replies
View Related
Dec 16, 2013
i have build a small project using access 2003 and vba code one of the forms contains sub form the main form contain the main data about school and in sub form populate different > textboxes for details about classes my problem is how to fill these text boxes in this sub >form for different grades depending on id of main form and how can i change the values and >moveing first or next buttons these are simple picture
View 5 Replies
View Related
May 2, 2014
I have five textboxes for husband with the values typed(HustxtAddress1, HustxtAddress2, HustxtCity, HustxtState, HustxtZip). I have five more textboxes for wife. I have a combo box asking whether the spouse's address is same as the husband - with yes or no. If "Yes" is selected, the text boxes for wife is auto filled with the same values of the husband. I tried with combo box change event setting HustxtAddress1= WifeText address1, it fills only the first field and other fields are empty.
View 2 Replies
View Related
Jul 3, 2014
I am trying to use this expression in my textbox to show when the textbox value is null:
=IIf(IsNull([ContractStatus]),"Null",[ContractStatus])
It gives me a circular reference error (#error in the textbox). If I change it to this:
=IIf(IsNull([ContractStatus]),"Null","ContractStatus"), it will display the text "Contract Status" (obviously).
What am I overlooking here? Does this need to be done in VBA?
View 9 Replies
View Related
Jan 10, 2012
is there a way to have a form set to either auto populate fields based on the FIRST FIELD? For example: if the user type in the STUDY ID, the other fields like (first name, last name etc..) are auto-populated/auto-filled? and if the STUDY ID is new and not in the table, then the users simply fill in all the fields/complete the form and save? And I would also like a message box to show when I am typing the STUDY ID that would say something like: this person is on the system already. Click YES for this person and NO to add the user?...
View 2 Replies
View Related
Jun 16, 2012
I have dependent combo boxes which is working fine what i want is to select the value from the list and the text box should be filled in my case it is attachment field i want to fill up the value based on combo boxes selection.I have attached the database also.
View 6 Replies
View Related
Jan 25, 2005
I would like the remaining part of my text control to show stars
e.g control value is 12
it shows *************12
control value is 3567890
it shows *********3567890
My text control does not have a fixed width, this is set in code depending on various factors
Thanks
View 1 Replies
View Related
Jul 13, 2005
Hi guys,
This is my first post of hopefully many, and I hope to be able to keep visiting and helping others in the future.
I'm building a database at the moment which I've done basing forms on Queries as I'm very familiar with doing so. However, one form in the database if a bit different.
The form in question is for shipping off refurbished units at the warehouse, by adding a SHIP ID to the record for each unit scanned in. The form before creates a recird ubdexed by a SHIP ID in the SHIPPING table, along with some other info such as delivery address and ship date. Each unit will be assigned this SHIP ID by the child form I wish to create, by scanning the Serial Number against it.
Two actions are done on the child form: Read in Serial Number of unit, find record in MAIN table and display key fields such as the units status (i.e. "WIP" or "REPAIRED" into text boxes on the form Allow unit to be shipped (by assigning the SHIP ID to the unit's record in the main table, only if the STATUS field shows as "REPAIRED"
Now, because I want to scan units into the form's Serial Number textbox and do the STATUS field check, then assign the SHIP ID; I need a recordset, right? I've inherited development of datdbases which used recordsets in their forms before, but have never had to create one from scratch. Also I wasn't able to take a copy of the source code of those databases before I left my last company.
Can anyone give me some info on what the bare minimum is to create a recordset, and to use it to save the record once I've made changes.
For your info I would consider myself an Access intermediate, and I've worked with it in various roles and versions for around 5 years.
Thanks,
Gareth
View 6 Replies
View Related
Jul 13, 2015
GOAL: select the IC number from the combo box and have 5 text boxes auto fill.
I have a table made for the IC number drop down. The columns represent the fields that need to be auto filled.
Making some kind of query to link the combo box entry to the text boxes? Some VBA where the control source is equal to my query? I have tried changing the text box control source to equal columns from my drop down but that did not work.
NOTE: the blue font in the first image represents the text boxes that need to auto fill when I select the IC number from the drop down. The second image is my table from which my combo box is generated. The acronyms are for the two tests on this form.
View 11 Replies
View Related
Mar 30, 2007
I want a help on this complicated issue:
On running a select query with "a*" of names in a table:
Results are : America, Argentina
Now I want this to dynamically create 2 text fileds in a form and fill America &".snp" in first and Argentina &".snp" in 2nd filed.
It is not regarding subform to display data of query result.
This I am going to use to add attchment for outlook email session as being discussed in my Email from access with attachment thread.
View 2 Replies
View Related
Oct 19, 2013
I have a combobox on an unbound form. After making a selection, I click a command button which opens a bound form to a new record. What I need to code next or add into the macro, is for the selection of the combobox to fill in the contact id, and contact name in the correct text boxes.
The combobox row source is: SELECT qryPBS.ConID, qryPBS.PBSName FROM qryPBS; bound column 1.
View 1 Replies
View Related
Dec 9, 2013
I use access 2013.
1) How to auto fill in a text box if you select a value from the last of 4 cascade comboboxes.
I have 4 comboboxes where
1 = Apparaat - cboApparaat
2 = Type - cboType
3 = OS - cboOS
4 = Probleem - cboProbleem
With all 4 comboboxes I have the vba code Me.cbo[name combobox].Requery
If I select the last combobox, cboProbeem. I want the textbox underneath to automaticly fill in the solution of that problem. I already tried to use the following vba code
Me.Oplossing = Me.cboProbleem.Column(5)
But it does not work.
2) I want to make a form for customers, where I can fill in customer info, device info and date when there contract started. Now I want to use SUM to fill in the end date of there contract.
View 3 Replies
View Related
May 21, 2014
I'm looking for a way to have a text box auto fill based on the selection of a combo box on the same form. I cannot use the method i find all over the internet of using multiple columns in the combo box and basing the text box on that because the combo box already has multiple columns being used to determine its own possibilities and other combo box possibilities.
I would really just like the text box to work like this, but im still kinda inexperienced in VBA...
If combo box is "F004-001", then text box is "237"
If combo box is "F004-003", then text box is "280"
I know how to add in an "after update" thing, but i do not know how to do If/then statements.
View 1 Replies
View Related
Mar 2, 2006
Hi everyone
I've seen a number of threads here, as well as elsewhere, which suggest that it's good practice to use a query to provide data to a subform, rather than placing data directly from the table.
I can understand the need for this if a special function of the query is needed, such as selecting certain records, performing calculations with some fields, reordering the information etc., but what if the data is to be transferred without any such manipulation? Is it still better practice to put the data through a query (that simply takes all fields from the table and doesn't modify anything) or take it directly from the table to the subform?
My "gut" feeling is that it wastes time (albeit a fraction of a second!) to have an extra step between the table and subform and, I suppose, another step where something could go wrong.
Is my logic correct, or is it ALWAYS good practice to use a query to supply data to a subform. If the latter, I will change my practice and use more queries.
Thanks for your responses.
View 2 Replies
View Related
Feb 24, 2005
In the attached db (both 2K and 97 ver) there is one form. Fill in the Date with 12/01/04 and the Start with 12/01/04 and Stop with 12/31/04. Press the Run Query button. The query is displayed...
How can I do it so on button press the form is filled with the query results?
View 1 Replies
View Related
Apr 16, 2013
I have now a database where I made a query that will show me all clients I can charge when there is a end date and an account number mentioned. I have also in a table where I put if the client is already charged. This is a check box that gives me yes or no. Is it possible to run the query and once those selected show up, to also add a yes to the table so next time I run the query the ones charged will not be charged again.
View 5 Replies
View Related
Oct 10, 2013
I have a query that produces a report for charges to the client. On the form I have a checkbox that when the client is charged it is ticked. What would be better is that when I run the query to export to excel, it should check all those checkboxes and the ones that are blank, fill them in (tick the box). Then I need to add to the query that that field should contain only blanks so it will show me only the ones that where not charged and then after producing the report check those boxes so it keep track of all the clients charged (to avoid double charge).
View 3 Replies
View Related
Feb 28, 2005
Hi all,
I've got another one for ya... I did a search, but must be choosing poor keywords because I can't find the answer I'm seeking.
Anyhoo, what I need to do is use a bit of information garnered from a database to fill in a line of fields on a form at the click of a button on a different database.
I have linked the table I need from the first database, and created the query that grabs the information I need to autofill. So far, so good. What I can't figure out is how to get this information to pop into the fields I want to fill.
I'd like to use a button with a click event to pass the data into each appropriate box (there would be 5 fields worth of info). I need to use a button because it won't always fill in the same line, which of course, adds to the complexity.
Can anyone point me in the right direction?
Thanks in advance,
Ceejay
View 2 Replies
View Related
Aug 18, 2015
I have a query that outputs results like:
Company ID | Data A | Data B | Data C
101 | results |results |results
102 |results |results |results
103 |results |results |results
104 |results |results |results
105 |results |results |results
In another Table containing additional company information, I have the primary key as the company ID, and I want to make the query that outputs the above table, auto-fill the blank fields in the existing Company information with the same headings as Data ABC etc.
However, I don't want the query to add full new records (which I think is the Append Query?), instead I want the existing company records have additional fields (Data ABC) added, with information from the Query added.
View 1 Replies
View Related
Dec 28, 2006
I have a column which contains "text digit text" as "AAA 222 BBB". The numbers of letters or digits can vary.
I need to SELECT the column which contains digits in a specific interval. For Example I have
"DFS 673 JKK"
"A 3454 LJLJ"
"SD 854 JKLJD"
I need to SELECT the column which contains 600 < Digit < 700 the result of the query in this case would be "DFS 673 JKK" because 673 is between 600 and 700.
Thanx for any clue or suggestion...
View 1 Replies
View Related
Dec 4, 2013
So i have made a query which filters the text you type in your text box on a form. This is working great, but then this morning I had some records that contain some blank fields. My query does not show those records even if they contain the same text that I would type in my search form.This is my expression in my query of one column:
Like [Forms]![searchform]![Qprojectomschrijving] & "*"
View 7 Replies
View Related