I need to create a New Form control for this situation:
If I enter a date into a field and the choice for another field is equal to a certain value. How can I get the date I entered to be automatically populated into another date field.
For example:
If I enter 11/10/2005 in a date field and I choose either "BN", "BA", or "BT" in a text field, I need that date of 11/10/2005 to be automatically populated in another date field on the same form.
I have a form where all records are listed on one page with a vertical scrollbar (all simple textboxes):
---------------------------------------------- PrimaryKey Name ForeignKey ---------------------------------------------- 1 Pam 20 2 John 20 3 Kim 20 4 Larry 20
... underneath these on the form is a blank record for NEW additions, which obviously has nothing in any of its textboxes, waiting for user to input some data, as normal.
The Foreign Key, due to the nature of my DB, will always be the SAME value for each record in the DB (don't ask, it's part of an export/import-to-main-db app). So I know that the NEW record, if created, will have the same value as the rest of the records.
How do I get it so that when a new record is created, the Foriegn Key textbox is automatically filled in with the value from the row above? (Due to referential integ reasons the Foreign Key field MUST be filled in accuratly or else an error ocurrs.)
Looking at the various events, I realise that it is the BeforeInsert event that will sort this out, but I'm at a loss regarding how to get the NEW record's Foreign Key textbox to match the Foreign Key value above it.
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 10 fields in a form where I put in years. is it possible that if the first year is filled in as 2006 (for example) that the next nine years fill up automatically as 2007, 2008, ......etc.
i have a form frmCreditNote with a subform sfrmCreditNote. They are linked by a creditNoteNumber. As soon as i pick a customer in the main form, i want the first line of the subform to have that customer name as well. If I change the customer name in the main form, I need the first line of the subform to correspondingly change as well. If the form was new, i would open a recordset and use .AddNew to put in the new first line date If I was updating the form customer name, then I would need a .Edit to change the first line of the subform. My question is : how do I determine if the subform is empty? Is it a command likeIf subform.HasData, orIf IsNull(?)Please let me know thanks
I wish to automatically fill in a form in datasheet view with records from a table. Currently you need to select each record to fill the list. I think this can be done using VBA, I'm a begininner to programming but think I need the code to do something like this.
Lookup the table or query, DoCmd select the first record, DoCmd select next record, Loop to end of recordset??
Basically it is automatically entering/ filling in each row (record) in the datasheet for every record in that table or query.
I made a bunch of tables by importing them from excel. Then I had someone ask me a question regarding a specific instrument. My tables have a bunch of parts and id's but I don't have the instrument associated with a specific part in the table.
Is it possible to add the data into the new column automatically using a query. I tried the append query, but I'm either doing it wrong or it won't do what I'd like it to do. I just want every record within that table to have the same instrument in an instrumentId column.
I have a form with a date of when training was completed. I would like to set it up so it displays the date of expiration which is one year from when the training was complete.
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 inherited a database where the structure is that everyone has a People ID which is unique and is stored in a central table. However to create a person you create their People ID in the People table (the ID is generated by autonumber) and to make the rest of the database work you have to manually type the People ID into a separate field in the form to allow you to do anything further. How can I automatically add this new number to the people ID list?
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.
hi there I am having some difficulty with using Access (aren't we all?) ;-( I have a table with a the following fields: START_DATE, END_DATE, RENTAL_PERIOD, DAILY_COST & TOTAL_COST.
What I am tring to achieve is that when someone fills in the START_DATE, END_DATE & DAILY_COST fields (which update the table behind the form) that the form will take the END from the START and put the result into the RENTAL_PERIOD field and then multiply this by the DAILY_COST value to automatically fill in and display the TOTAL_COST field.
It must be simple but I just can't get it to work and it's stopping me from sleeping :mad: I have found myself doing Access in my dreams which is not good!!
Any tips much appreciated - Thanks Mike
PS I have written 2 queries which will calculate this for me but dont seem to be able to action the queries from within the form (if that helps!)
I have a number of tables in my database, and they're linked in with a form. I'd like to have a field in a form that's populated automatically based on what's inputted in a different field.For example, I've got one table with names and descriptions on widgets (name in column A, description in column B).
Widget 1 This widget is blue Widget 2 This widget is green Widget 3 This widget is yellow
When I'm in my form, I want when I select Widget 1 to have the corresponding text (This widget is blue) appear in a field below.
I'm a maintenance coordinator for a small trucking company and I'm putting together an access database to track and manage all of our fleet maintenance. I'm rank amateur when it comes to access but I've been doing ok with it and so far I've been able to get it to do almost everything I set out to have it do.
But I'm having a hard time figuring out how to make this trick work. Here's what I want it to do. We have two groups of trailers, working trailers and storage unit trailers. We do preventative maintenance every six months on road trailers and once a year on storage units. I have a field in tblEquipmentMaster which shows the last PM date. I have a query and an report which use that LastPMDate field as well as the value of a StorageUnit checkbox to calculate what units are due/overdue for PM.
In addition to all this, I've got tables and forms set up to track maintenance records. I'm tracking the maintenance invoices as well as the details of each line item on the invoices (changed water pump, replaced tail light, PM service etc). So what I'd like to have happen is for the LastPMDate field in tblEquipmentMaster to update to the value in InvoiceDate in tblMaintenance anytime the field Description in tblMaintenanceDetails contains the text 'PM' for the unit number in question. Alternatively tblMaintenanceDetails also has a lookup field which contains maintenance codes. So the field VMRSCode could also be used as the trigger anytime the value 'PM' is selected.
I have a form where I select either "Male" or "Female" via tick box. If male is selected I would like it to automatically enter "he" in my table in another field so I can use this info in a Word template letter.
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.
I have an entry form for a table named [Group Members]. The form has several fields deriving data from 2 other tables [Mail List] and [Groups] I wish to automatically display a Group ID when the relevant Group Name is selected from a drop down list.The Row Source Code is as follows;
SELECT [GROUPS].[GROUPS ID}, [GROUPS].[GROUP NAME FROM GROUPS].
The Bound Column is 1.This code fails to display the [GROUPS ID] when a Group Name is entered. Which other controls do I need to modify to achieve this simple matter? I have similar code installed to achieve auto display of Member ID when Member Name is entered. That code is equally ineffective.
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.
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.