Modules & VBA :: Adding All Records From A Subform To Table?

May 26, 2015

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

[code]....

View Replies


ADVERTISEMENT

Modules & VBA :: Adding Records To Subform

Sep 9, 2013

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?

View 7 Replies View Related

Modules & VBA :: Adding New Records To Subform On Load

Jun 3, 2014

I have got a received form that has 2 subforms.

The main form is based on Received Table

The 1st subform is based on a query that shows the order detail and how many units are outstanding.

The 2nd subform is based on a receivedDetail table. so will have a list of items with the original order qty, and the qty still outstanding.

When the main form loads i want it to create new records into the 2nd subform based on the 1st Subform.

so the 1st and 2nd subform run parallel with each other and appear to be as one to the user.

both subforms are continuous style.

Code:
Private Sub Form_Load()
With Me.Form.RecordsetClone
Do While Not .EOF
.AddNew
!UserFK = Forms!frmReceive!cbxUsername

[Code] ....

View 3 Replies View Related

Forms :: Adding Multiple Records To A Table Using Main Form And Not A Subform

Sep 12, 2013

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?

View 2 Replies View Related

Modules & VBA :: Adding New Record To Related Table In SubForm

May 13, 2015

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..

Me.RFV___Agencies1.SetFocus
DoCmd.GoToRecord , , acNewRec

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.

View 1 Replies View Related

Modules & VBA :: Adding Records In Multiple Table

Nov 13, 2013

I have two tables :

Table 1: Mission_Id , Mission_Type, Customer_Name...
Table 2: Supporter_Name, Report_Date, Area, Unit, Issue_Type, Error_Status,Mission_Id

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?

View 4 Replies View Related

Modules & VBA :: How To Lock A Table - Stop User Adding Or Altering Records

Sep 19, 2013

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'.

View 4 Replies View Related

Modules & VBA :: Delete Records From A Table Using Controls On A Subform

Jun 20, 2013

I have a sub form that allows users to add staff to a project team, once added it populates a table which updates the subform showing the selected employee. I am trying to enable a delete function that allows users to remove an employee from the project team in the subform showing selected staff. Here is the code I have so far, but it doesn't work;

Code:
Private Sub Command4_Click()
Dim dbs As Database
Dim rs As Recordset
Dim sqlstr As String
Set dbs = CurrentDb
sqlstr = "DELETE tbl_CapexStaff.* FROM tbl_CapexStaff WHERE CAP_ID = Forms!frm_Switchboard.CAP_Live"
dbs.Execute (sqlstr)
End Sub

View 4 Replies View Related

Adding Records In Subform

Jan 18, 2006

Hi,

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.


Regards.

Fabiano Gaiga.

View 2 Replies View Related

Modules & VBA :: Adding Image - How To Use Continuous Subform Instead Of List Box

Aug 15, 2013

I would like to add image to list box but i read somewhere i have to use continuous sub form instead.

Now i like to know in sub form also we can select multi items and it shows highlighted entire of each row and easily getting value if selected items.

View 4 Replies View Related

Modules & VBA :: Class Variable Resets When Adding New Record In Subform

Mar 30, 2015

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.

View 3 Replies View Related

Modules & VBA :: Appending / Adding Certain Records To Another Database

Feb 17, 2015

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.

Here is the SQL from my query:

INSERT INTO Issues ( Customer, Title, [Due Date], [Opened By], [Opened Date], Priority, Comments, [Job Number], Description )
SELECT [TBL003_Combined Data].CUSTOMER, [TBL003_Combined Data].TITLE, [TBL003_Combined Data].[DUE DATE], [TBL003_Combined Data].[OPENED BY], [TBL003_Combined Data].[OPENED DATE], [TBL003_Combined Data].PRIORITY,

[Code] ....

And here is how I "thought" I could fix it through Access VBA:

Function UpdateIssuesDatabase()
Dim con As Object
Set con = CreateObject("ADODB.Connection")
On Error GoTo UpdateIssuesDatabase_OpenError
con.Open _

[Code] .....

I have highlighted where it is giving me the issue.

View 9 Replies View Related

Modules & VBA :: Loop Through A Recordset While Adding New Records To Another?

Jun 9, 2014

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?

View 8 Replies View Related

Modules & VBA :: Adding And Editing Records From Unbound Fields

Mar 4, 2015

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

[Code] .....

View 6 Replies View Related

Modules & VBA :: Adding Effective Date Indicated By User To All Records

Sep 12, 2013

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

[Code] .....

View 1 Replies View Related

Adding New Records To Table Based On Values In Another Table?

Aug 19, 2015

I'm developing a database for the hospital I work in. One purpose of this is to keep track of patients with temporary invasive devices (there are many types such as urinary catheters, ventilators, etc.), specifically how many days each patient has a device for. Each device is associated with one patient only, but one patient may have many devices. Here's how the associated tables are set up:

1. tblPatients - PatientID (PK), LastName, FirstName, DOB,...
2. tblLocations - LocationID (PK), LocationLabel,....
3. tblDevices - DeviceID (PK), DeviceType, Device, DeviceDesc
4. tblDeviceUse - DeviceUseID (PK), DeviceID (FK), PatientID (FK), LocationID (FK) (where in the hospital was device inserted, e.g., operating room, bedside, etc.), DeviceStartDate, DeviceEndDate
5. tblDeviceDailyLog - DeviceLogID (PK), DeviceUseID (FK), DeviceDate, PatientLocID (FK) (area in the hospital that patient is in)

All primary keys except for PatientID & LocationID are Autonumbers; and the tables are linked appropriately.

Whenever an entry is made into tblDeviceUse, I want there to be new records to be automatically generated in tblDeviceDailyLog for each date between the Start and End Dates. For example, patient A123 had a urinary catheter from 1/1/2000 to 1/10/2000 that was inserted while the patient was in the ICU, but the patient was moved to the Medical Ward on 1/7/2000. So tblDeviceDailyLog should have 10 new records associated with this device, one for each calendar day, with the appropriate location for each day.

View 3 Replies View Related

Adding Records To Table

Feb 9, 2005

Hope someone can help!
I was wondering if is possible to add a series of records that are in serquence to a table by just entering the first and last numbers. For example a string of numbers starting at TP11000 and ending at TP11100, the prefix TP doesn't change. Currently I have to enter every one manually, so any help would be much appreciated!

View 4 Replies View Related

Adding Records To A Table From A Form

Apr 11, 2006

I am new to Access and have the following problem. I have one table which displays Skills (memo field) a second table which displays a skill rating ( 5 choices) and a third table which list the jobs in the company. I need to compile a fourth table which lists the skills required for each job and the corresponding ratings. I would like to have a Form in which I select the job and all 560 skills are displayed in datasheet format and I can select the ones required and allocate a skill rating. The results should then be saved to the new Table.

Any ideas as to how to acheive this task.

View 2 Replies View Related

Adding Records Directly To A Table.

Aug 13, 2007

Here is basically what I have and what I need to do:

I have a form with several text boxes which are going to be filled in. Clicking on a button at the bottom of the form will save this information into a table (the table associated with the form). However, it also needs to fill in a junction table with two known values derived from these text boxes.

I have FILE_NUMBER_CD and INSPECTOR_NUMBER_CD that are the only attributes in the table called "XREF_FILE_INSPECTOR" which need to be added as new records.

So basically, what I need to know is how do I add known values derived from a textbox directly into a table.

Thanks for any help!

View 1 Replies View Related

Adding New Records To A Linked Table

Jun 5, 2006

Greetings all.

I'm posting this question here as it pertains to my form but it could go in tables section as well.

I developed a prototype app in Access and have just finished upscaling it
to Sybase 12.5. When I open up the associated form to add records, I am unable to do so. The built in button that allows you to do so is greyed out.
When I go into the table directly, again, no ability to add recs.

I've never come across this so if anyone has any experience with this, any help would be most welcome.

TIA,
Tim

View 1 Replies View Related

Adding Records To Related Table

Sep 28, 2006

Hello I need to add daily records to a related table using a form, from a button or subform displayed on a form updating the master table.
This would enter the related key to the new form ready for insertion etc.
Can this be done?

For example

Master table:
Key 1


Related table:
1 Key 1
2 Key 1
3 Key 1


jamo

View 2 Replies View Related

Adding Records To Table From Other Form

Oct 12, 2006

I have a form "release_details" having fields date, version, cksum ,comments,labels, and is link to a table,
it has a button "mai"l ,on clicking this button a new form is open which has a button "send mail" on clicking this a mail is sent and pops a message "mail sent".I need when "send mail" is click it should also save the fields of form
"release_details" to the table.


cmdSend_Click()
Forms!Enter_Release_details.Dirty = False

View 3 Replies View Related

Modules & VBA :: Updating Or Adding Records To Form - Find MAX Of Number Portion

Jun 28, 2013

I want whenever I'm updating or adding records to my form, the ID automatically take the value of the previous ID and increment it by 1.

The field type is text (mixed with number) - PM0000000.

I've done some research, what I understand is that I need to:

-do a lookup and
-find the MAX of the number portion.

Name of form - Payment
Name of table - Payment
Name of field - payment_id

I tried these, but to no avail...

Private Sub payment_id_Click()
payment_id = DLookup(("[payment_id]", "Payment", "[payment_id]=Forms![Payment]![payment_id]-1")payment_id + 1)
End Sub

[Code] .....

View 8 Replies View Related

Adding New Record With Table That Has Duplicate Records

Jan 26, 2005

My situation:

I have a table with duplicate ids. When I have a forum popup another form, the forms are linked by ids. This works great except for one problem. There are duplicate ids. So if I pop up a form then it will go to the first record that that id exist. This is not good if you are going to add another record. Therefore, I need to create a unique variable for a record. The autonumber would be a great variable but it seems I cannot use it to filter. Unless someone can show me how. Is there another way to create a unique variable automatically for a new record?

View 5 Replies View Related

Tables :: Adding Records To Existing Table

May 19, 2014

What I have is a database that I have done some tweaking on and in the meantime the original db has been in use which has added around 200 or so more records in the table.

What I would like to do is to just update the db that I have been working on with the older db table(the one who has the additional 200 records).

EX. DB A(Old DB, Newer Table) DB B(New DB, Older Table)

I want to put DB A table into DB B

Is this a simple fix? Or do I need to write some sort of query to update the records in the old table? I've tried to export the excel file and then import but it puts it in unrelated objects and then my switchboard or nothing works.

View 9 Replies View Related

Forms :: Adding New Records To A Linked Table

Sep 24, 2014

Is it possible to add new records to a linked table ? i tried it out but new records is not possible, is there a workaround for this.

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved