General :: Populate Form Field With Value From Query
Mar 24, 2014
I am trying to calculate the keystage and year group of pupils on my database. I have created queries that successfully calculate the data, but I cant work out how to add the results from my queries into an already created form. I thought I could use DLookup, but this just populates with a random value from the data and not the value for that particular pupil.
I'm trying to populate a field in my form from a query. I've been trying to figure it out from the web but can't get it sorted. I've got a combo box that selects a member of staff from a table, and then a query runs which takes the value from that combo to retrieve the staffs current rate of pay.
I've added this code to the on change event on the combo.
Private Sub cboStaffID_Change() Me.txtunit.Value = [qrycurrentpay]![Unit] End Sub
But it doesn't seem to work,
txtunit is the field I want to fill on my form, and Unit is he field name of the value I want from query qrycurrentpay.
basically i'll have one table, containing several fields. name/website/date.i want to create a form/s for users to use. 1 is to allow the user to create a new record. i've completed this ok
the second form is to allow users to open a form, enter/select data and run this.....and the output goes to a report.i've created the query ok.....however, when i create a form to "link" to the query open the form, it shows all my records in table i.e. i can move through the records (from bottom of form) and when i actually fill in the form it actually modifies the data in the table.
I am wanting to populate a field by entering a date in another field. I am trying to determine age(years, months, and weeks) of something by entering a date in another field. Is that possible in Access?
I have Field "BC1Chng" which requires user input. I want to be able to write a code to reference to "BC1Chng" if there is an input in that field for any record...I want to copy the Remarks into each record in the Remarks Field.
I was able to get the remarks1 field to loop through each record copying what was in that field into each record.
Now I want it to look at the BC1CHng field and only copy to remarks1 field if there is any input in that field???
I need to populate a table with Grid reference values consisting of 6 figure integers, eastings and northings.
I am receiving/downloading the Grid Refs in a UK Grid Tile format, with 3, 4 or 5 figures preceded by letters.
E.g. SK 456 849, SP 6789 4356.
I have used some query functions and written a bit of VBA behind a form to convert the received coordinates into the full coords I want. The coordinates are now in unbound controls on a form, and I want to pass these back to a table so I can use the data for display purposes.
Ideally I want to link to the table from a GIS and autoupdate without having to open the database (my imported data is linked in to feed the database automatically).
I have done some searching and not found a method to pass the values into a table - What is my best way of doing this automatically?
On paper I have designed a faculty contact database and have now come to the point where I am designing the form. In the contact information table are Cell, Home, Office fields as well as Personal, Work, Alternate email fields which will contain the corresponding information. On the form after the information is entered the person needs to select an option from each of four combo boxes to indicate which is the preferred number, number for student, preferred email and email for students. The question is how to populate the text fields in a report based on the selection of the combo boxes with the information stored in the corresponding field (cell, home, office phone numbers and personal, work and alternate email). I am assuming it is done in the query but I don't know how or can it be done in vba?
I have a training log that has 4 tables, the employee table, the training course table, and the department table.
These tables all contain the names of employees, training courses, and department in one field and their respective ID codes in the other.
The 4th table is the actual log where the manager logs in who took the training courses. When the manager goes to select the employee name, course name, and department name is there a way not using VBA for the respective ID number to appear in the 4th table (they use the same field names and are related)
I have a table of data which includes a date field and also various other fields which may or may not be filled with data.I'm trying to populate a listbox with the months for which this data is missing (a separate macro will then loop through these months to fill the missing data) But I only want each distinct month to populate the listbox - not each individual date.
Code: strSQL = "SELECT DISTINCT month([EntryDate]), year([EntryDate]) FROM [SampleTable] WHERE [ValueField] Is Null" Me.lstSampleListBox.RowSource = strSQL
I have a Table (tblFPAData) that is being populated with entries from a form I created. There are several fields but if I can get an answer for one relationship then I can repeat it for the others.
In tblFPAData there are the fields MaterialNo and Description.
I am creating another table called tblSchedule and using a form to enter the information. I need the user to select the MaterialNo from a combo (cmbMaterialNo) and the then table auto populates the Description from tblFPAData.
I am struggling with a slight form delay. When it opens on the OnOpen event, i am populating a grid. This takes about 3 to 5 seconds but, the it also takes the form the same time to open. What i need to do is get the form to open then populate the grid. Can i make the form open first then populate?
I have a form set up (in a list box) to show our salespeople what parts they have yet to get out of inventory but have a sales order for. The list box shows a list of all the salespeoples names. My manager wants me to show ONLY the salespeople that have populated fields in this list box. The list box currently shows all the salespeople, but I want to see only the ones that have inventory that has yet to shipped. How do I go about this?
What really is the best way, programming-wise and user experience-wise when presenting records in a form:
1) Use the form with sub-forms to show records. Add new records via a popup form and use recordsets in VBA to allow validating.
2) Use unbound controls on a form and populate with pure VBA recordsets. For data with more than one row use list boxes. A popup form used for adding new or editing etc using VBA.
3) Another I haven't thought of; new or a combination of above?
I am new to access and have been staring at the same Run-time error for 3 days (pathetic I know). I cannot for the life of me figure out why it does not like my Dlookup. Esentially, I want and After Update event in my combo box to populate a Rich text textbox in my form. After reading DLookup is the easiest way to make this happen. Here is my code:
I have a main screen that has a tabbed form in it. Each of those tabs has a sub-form in it that displays information and allows some information to be updated.
In one tab I have a query based sub-form that returns information related to the project. This information cannot be manipulated or changed as it comes out of a company managed database. I would like the analysts to be able to add more granular information to a new table by inputting information in a dropdown field for one of the new table fields, but utilizing two of the existing sub-forms fields as identifiers in the new table.
I have attached a sample of my DB so you can see for yourself what i am trying to do. I want to capture the SSN on the search page so when I go to P1 or P2 that persons info is all ready populated on the right side of the page, but still allows for a search after I have updated the record.
I have a listbox that is populated with data from a table. I would like to use one of the columns data as the where clause of a sql string that will populate another form, how do I get the selected items column data that I need into a variable? This is in Access 2010 vba.
I have a form with fields "Assigned To" and "Assigned Date". When "Assigned To" receives a value, i.e. Not=Null, I want to auto-populate the "Assigned Date" field with the current date and time. How can I do this? Any help is appreciated.
Hi, just a quick question that i hopes not too hard.
Basically i want one of the fields on my form to get automiatically filled in. I'd like it to take the first letter from one field and the first letter from another field. What im trying to do is make a primary key field up from other fields they have entered.
So for adding new customer i want it to take the firstletter of the firstname and first let of the surname.
SO for myself Luke Tarrant it would be LT. Then i suppose i'll need to add some unique so there no duplicates as it a primary key field im trying to populate.
Just wondering if this can be done: You enter data in the first text box of a field on a continuous form, and all the remaining records are filled up with the same data.
On a command button in pfrm_AddClientDuplicateCheck I have the following code.
Code: Private Sub cmdAddNewClient_Click() DoCmd.OpenForm "pfrm_AddClientPrimary" DoCmd.Close acForm, "pfrm_AddClientDuplicateCheck" End Sub
This works great
On the onOpen event of the pfrm_AddClientPrimary form I have this code
Code:
Private Sub Form_Open(Cancel As Integer) Me.FirstName = Forms!pfrm_AddClientDuplicateCheck!txtFirstName Me.LastName = Forms!pfrm_AddClientDuplicateCheck!txtLastName Me.SocialInsureanceNumber = Forms!pfrm_AddClientDuplicateCheck!txtSOcialInsureanceNumber Me.FirstName.SetFocus End Sub
This fails on the first line with this error Run-time error 2147352567 (80020009) You can't assign a value to this object
I am aware of the incorrect spelling of Me.SocialInsureanceNumber this is the way it is in the db.
I have three list boxes on a form (lstSubjectName, lstTargetGrName, lstCountryName). The list boxes are populated from queries based upon tables that have a many-to-one relationship to the main table. The queries are the following:
SELECT tblProjectSubject.ProjectID, tblProjectSubject.SubjectName FROM tblProjectSubject WHERE (((tblProjectSubject.ProjectID)=[Forms]![frmViewPro]![ProjectID])) ORDER BY tblProjectSubject.SubjectName;
SELECT tblProjectTargetGr.ProjectID, tblProjectTargetGr.TargetgrName FROM tblProjectTargetGr WHERE (((tblProjectTargetGr.ProjectID)=[Forms]![frmViewPro]![ProjectID])) ORDER BY tblProjectTargetGr.TargetgrName;
SELECT tblProjectCountry.ProjectID, tblProjectCountry.CountryName FROM tblProjectCountry WHERE (((tblProjectCountry.ProjectID)=[Forms]![frmViewPro]![ProjectID])) ORDER BY tblProjectCountry.CountryName;
The form is based on the main table (tblProjects). I want to re-populate/update the list boxes when the ProjectID on the form changes. I have tried to use a macro (ProjectID_AfterUpdate) for requery of the list boxes, but can't get it to work. Any other solutions? Thanks. Niels
I have looked at multiple samples on this forum and others and cannot seem to get the result I want working.
Have main form TmLdr made from table of same name. Entries include ReqName and CostCenter. These same entries are on a subform. On the After Update event on the CoRecDt (main form), I want the name and CostCenter entered on the subform to populate on mainform. This subform will be filled out by the user once and as long as they are using their own machine there will be no need to re-enter their name.
I think that I am so close but just a touch away. I am attaching my DB with hopes someone can take a peak at it and let me know what I am missing. Thanks so much.