I have button the when pressed will insert a record (via an insert into query) to the frmMain and several records to the frmSub.The problem is when a new record is created in the main form the auto number primary key advances. This is fine however the linked Child field which is a foreign key of the main form is not added and the value is blank. I thought this would happen automatically and the Master field would force the child field to be update but this is not happening.Do I have to determine the max number used in the auto number then add 1 to it?
I am working with a database that deals with trailers. What is happening is a salesman takes an order for a make and model for a trailer for a customer. The customer can then add some customization to the trailer such as more tail lights or tie down straps. They add the customization on a form called frmCustomQuote. On frmCustomQuote there is a subform called sfQuoteConfigs. On sfQuoteConfigs there is fields such as category and sub catergory that get populated bases on what was selected.
On frmCustomQuote there is a button called "Copy Quote" this will allow the salesman to make an exact copy of the trailer and customization. The quotes are held in a table called tblQuotes and the customization is held in tbQuoteConfigs. Now my problem is when I click on Copy Quote it only copies the first record into tbQuoteConfigs. I can't figure out a way to tell my code to move to the next record within sfQuoteConfigs.
My code:
Code: Option Compare Database Option Explicit 'Setup ADODB connection to the tblQuotes Dim adoQuotesCustomQuote As New ADODB.Recordset 'setup ADODB connection to the tbQuoteConfigs Dim adoQuoteConfigsCustom As New ADODB.Recordset 'Dim the Variables
I am having an issue trying to show all records when I load my form. It loads correctly when I don't have a record source for the main form. However, the combobox filters will not work. My goal is to have users be able to use the datasheet, subdatasheet and combobox filters. I can get the form to work just fine when I link the Main form and subform, but when the form opens it is filtered on the first record. I have been successful with this approach when using other forms, but they didn't require a subdatasheet.
Is there anyway I can have the comboboxes to filter yet be able to show all records until the user selects filters? Is this possible?I finally got my Manager to agree to use a database instead of Excel files based on this form setup and I need to make as "user friendly" as possible (look and function like a spreadsheet) I attached some pics of the form along with the code for the filter.
The problem I am facing is applying an IF statement to every record in the detail section of the subform.
I have the following code:
Code: If Me.status = "CONFIRMED" Then Me.course_ref.Enabled = False Me.course_date.Enabled = False Me.cmbModule1.Enabled = False Me.cmbModule2.Enabled = False Me.course_start_time.Enabled = False Me.course_end_time.Enabled = False Me.course_training_cost.Enabled = False End If
This is in the on load event of the subform and works 'sort of'
Basically I have a record with the status of confirmed and records without this status, but the result of the if statement is being applied to all records. Is this because I need some sort of loop? and if so how would I loop through all records in the detail and apply this if statement to them all?
I am a bit stuck now and I want to validate several points with you.
First let me explain the context: I am writing a timesheet application and I've got a main form + a sub-form. In the mainform, I select the engineer, the contract and the week to input. My mainform calculates the first and the last day of the selected week and modifies the recordsource property of my sub-form to select the records with the right engineer + contract nbr + range of first and last of week. This means that I can only have maximum 7 records for the seven days of the week because the application records only a global time per engineer/contract/per day.
Here it becomes tricky and this is the most difficult part of the application (I hope); what I want to do is to help the user having to enter the times.
so I need to retrieve the records but if they don't exist, I want to create new records with engineerId, ContractID, day of the week and let the nbr of hours to zero. This in fact will help the user because he will have only to complete the nbr of hours. Iw ant obviously to present those entries in the right order; I mean in ascending ordre based on the day of the week.
Eventually, when the user has completed the week, what I want to do is to update the existing records, insert the new records where the number of hours is > 0 and discards rhe records where the number of hours is = 0.
I know this is a bit tricky to understand but if you could give the main ideas to implement it would be very grateful.
I have an existing Main form that has a sub form that the user uses to enter multiple records into a table....it works fine EXCEPT that I need to make it even easier and more intuitive and add a lot of labels. Basically the user selects items from a drop down list that adds items to a Work Order. I need to add some labels to the form to make it more descriptive for the user.
So, what I want to add multiple records using a single main form.
Is is possible to?:
1. simply turn the subform into a single main form? Can this be done by using a Command button or something similar?
2. copy all of the controls etc from the sub form into a new main form and have it all work nicely?
I am currently working on an Access Database that houses our security clearance information. Most of the system is up and running but the most recent form has got me spinning my wheels. I have a Word User Form that users will download and complete, once completed the macros will automatically send us the document to be added to our database. Most of this is working the problem is that this portion of the database has multiple related tables and at any given time a user may require multiple records in the related tables. I have created the code to copy most of the information but am getting stuck adding a new record on the sub-form when multiple items are required. Here is a breakdown of the scenario
Word Doc Table 1 = Basic Organization Info Word Doc Table 2+ = Sites to Visit (There could be more than 1 table added here) Word Doc Table 3+ = People to go on site (this might not be the third table based on user interaction for sites)
So far I can get Table 1 and Table 2 data but if there are more than 1 site I cant seem to get the system to create a new record on the related table it is creating a new record on the main form. Here are the lines I used to try to create the related record..
When I put just the above code on a button it seems to have worked as the sub-form showed an additional record was created but when using this on my macro the sub-form is not taking the focus for some reason.
I have a parent form which has a class variable (class module instance) to store the form' status and more.... and when i add a new record to the subform it resets the class variable field' data. but this only happens on first transaction, but if i re-run the steps (re-set the variable field value) it's not happening again.
The goal I am trying to accomplish using VBA within Access 2010 is to append/add certain records to another database (Customer Service) from my database (Client Request). I tried using a macro to append then update records in my database but there is a "lag" time as to when the information is updated in the 'Customer Service' database causing my updates not to occur.
I have a form that the users enter data into and send a report each day. I would like that in a click of a button all the data I entered the day before and that have ="Open" will be entered into the tables with today's date. Is that possible?
Is there a way of looping through a form record set, while adding new records to a different form record set? using some data from the 1st record set in the new records?
I total novice at VBA. I am trying to code a button to modify (the last) record in a subform list and then add a new record based on values in unrelated or unbound fields on the button form.
The following code is based on the first of two YouTube tutorials (this bit on the edit) and looks like it should work. Except that my Access 2010 with Visual Basic for Aplication v7 does not recognise the type definition Database or Recordset
Code: Private Sub ANOwner_Click() Dim cn As Integer Dim db As Database Dim rs As Recordset Set db = CurrentDb
I'm trying to run a saved import through VBA, add a new column called "Effective_Date", then update this field for all records to the effective date indicated by the user.
It currently works for all records except 1 is always omitted.
Code: Private Sub cmd_upload_staffing_report_Click() DoCmd.RunSavedImportExport ("Import-AccessUploadStaffingReport") Dim strField As String Dim curDatabase As Object Dim tblTempEmployees As Object Dim fldEffectiveDate As Object
I was wondering if it is possible to load multiple forms into one subform? For example: I have form [SO2Menu] and form [Critical]. Can I have one subform in a main form that by the click of a button ill load either menu depending on the users selection?
I have a form that allows a user to complete a stock take. I would like to stop other users from receiving or despatching stock while a stock take is in progress.
Is there a way I can lock a table, or stop users adding or altering records that match certain criteria. i.e. don't let users receive or despatch stock from with a locationID of 'A'.
There are 2 issues I am trying to figure out for an Access2007 form:
1) I should first state that I am working off of 3 tables: a) Marketers b) Companies that belong to those marketers c) Points of Contacts (POC) for each Company
2) In my frmMain, I have 2 combo boxes. The first loads the second and the second loads a CompanyID text field (IDc) that the subform bases for which record info to pull. How do I get the CompanyID (and subform) fields to load blank upon form open and until the 2nd combo box selection is made?
3) A company that doesn't have any POCs entered yet won't load its CompanyID even though it DOES have an ID number. Well the Id not being changed doesn't change the POC info either. I am guessing it's because there is no info to fill in the subform yet. However, I need to be able to still pull up the blank fields so I can ADD a POC.
I have created a FE/BE database which is operating on a network. There is one FE for each person (approx 150) all accessing 1 BE. There are at most, maybe 10 people using it at once. The database has been working well for about 2 months.
My problem is not with data corruption (touch-wood!), but with a complex form.
The Form is split into a Header/Footer, with a Detail section containing a subform. The main form filters records that appear on the subform. The subform is continous, with several conditional formatting cells per record.
Most of the time it works fine, but occasionally, the main form opens, but the subform fails to load/open. All I see is a white page with the main form header displaying correctly along the top 1/3rd of the screen. No error message is displayed. If I print the page using a Report (The subform and Report use the same query) the page prints perfectly with all records showing.
I have seen this problem on several different workstations, only to try again later to see it working (having closed the db, logging off then back on again)
I am at a loss with this one. Is it a problem with Access or the network? I am unable to find anything similar to this problem on the forum. Can anyone shed any light on it?
I have a form which has a subform that holds records from a table. When in the table i can move through the records with my up and down arrows but when I am in the subform i can not move in the same manner with up and down arrows. What needs to be done on subform to allow user to move through records using up and down arrows.
I have a form with a subform. I would like a control in my parent form to uncheck a checkbox control in my subform when that field value is deleted . I can get that to work if there is only one record in my subform but it doesn't uncheck the rest. how to I reference all the records in my subform so all of them will uncheck when I delete that field value?
I have created three forms using three tables tblUser, tlbMeasure and tblSubMeasure. The tblUser is linked to the tblMeasure table via UserLogin and tblMeasure is linked to tblSubMeasure via MeasureID. The forms are created with frmMainMeasure being the main form and frmMeasure6 a subform and frmSubMeasure a sub with frmMeasure6.
I want to be able to add sub measures that will be linked to each MeasureID and each MeasureID link to each user via UserloginID. The forms load the data in the sub forms but when I try to add sub measures using a button I added on the frmMeasures6. The button works when I try work on the form fine but when I try via the main form I am not able to add or view other records within the table.
When I click the Add button I want to be able to load back the same MeasureID number in fmrSubMeasure to ensure that it is linked to the same measure and the MeasureID is linked to the same UsrrLoginID.
The code is included below and I've attached the file as well.
Private Sub cmdAdd_Click() If Me!frmSubMeasure.Form.Dirty = False Then End If Me!frmSubMeasure.SetFocus DoCmd.GoToRecord , , acNewRec
I am trying to add a save/close button to a form that will only close if certain conditions are met and if they arnt then display a message box.I got the basics on how to save and close the form, do a simple if statement and display the message I want but the problem im running into is my subform can have multiple records and of those records each records status is set by 3 different checkboxes. I need all of those records status to be same when the form is closed.
if I do an if statement like
If Me!frmDataform1subform.Form!StatusID.Value = 1 then docmd....
then all it looks at is the first record, how do I get my if statement to look at all the records in the subform?
I have a form that contains a subform. I want to make a button that on click updates all the records listed in the subform. This is the best I came up with.
Dim rs As DAO.Recordset Set rs = Me.SubList_for_Billing_Center_Form.Form.RecordsetC lone With rs .MoveFirst Do While Not .EOF .Edit UPDATE Billing SET Billing.Billing_Declined = True, Billing.Billing_Declined_Date = Date()