473,671 Members | 2,283 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form to select the data from a table using multiple queries, save to another table

Hi all,
I am new to access and am finding it a bit unintuitive having worked
with SQL server in the past... And I am in a bit of a hurry because my
employer wants me to crank something out which at first seemed like a
piece of cake but I realize now I should have done a little more
research before I got started. Here is the issue:

I have a table with data relating to our pastry products. I built a
form with multiple combo boxes that are limited by category etc so that
the pastry chef can use the form to create his production schedule for
the week. This worked great and he can print the schedule. But now I
want to save the schedule as a record in another table so that next
week when he goes to do the schedule, he can see what he did the week
before.

Everything I read seems to discuss how to create a form to ENTER data
to the table it is associated with. But not how to take the data
selected in the form and to save it to another table. Any help will be
thoroughly appreciated.

Tara

Jun 21 '06 #1
4 2370

tarafinlay wrote:
Hi all,
I am new to access and am finding it a bit unintuitive having worked
with SQL server in the past... And I am in a bit of a hurry because my
employer wants me to crank something out which at first seemed like a
piece of cake but I realize now I should have done a little more
research before I got started. Here is the issue:

I have a table with data relating to our pastry products. I built a
form with multiple combo boxes that are limited by category etc so that
the pastry chef can use the form to create his production schedule for
the week. This worked great and he can print the schedule. But now I
want to save the schedule as a record in another table so that next
week when he goes to do the schedule, he can see what he did the week
before.

Everything I read seems to discuss how to create a form to ENTER data
to the table it is associated with. But not how to take the data
selected in the form and to save it to another table. Any help will be
thoroughly appreciated.

Tara


Hi Tara,

The code that you need is:

Public Function WriteDetails()
Dim rsRead As New ADODB.Recordset
Dim rsWrite As New ADODB.Recordset
Dim sql As String
sql = "Detail1, Detail2, Detail3, Detail4, Detail5 "
sql = sql & "FROM tblPastry"
rsRead.Open sql, CurrentProject. AccessConnectio n,
adOpenForwardOn ly, adLockOptimisti c
sql = "SELECT Field1, Field2, Field3, Field4, Field5 "
sql = sql & "FROM tblTable1"
With rsWrite
.Open sql, CurrentProject. AccessConnectio n, adOpenDynamic,
adLockOptimisti c
.AddNew
!Field1 = rsRead!Detail1
!Field2 = rsRead!Detail2
!Field3 = rsRead!Detail3
!Field4 = rsRead!Detail4
!Field5 = rsRead!Detail5
.Update
.Close
End With
Set rs = Nothing
End Function

Where the detail rows are the data that you have, and the Fields you
will have to create manually, but will be updated automatically. This
is how to do it using ADO but if you are from a SQL Server background
why do you not write an append query that references a form for the
date or some other unique number?

Jun 21 '06 #2

Nick 'The Database Guy' wrote:
tarafinlay wrote:
Hi all,
I am new to access and am finding it a bit unintuitive having worked
with SQL server in the past... And I am in a bit of a hurry because my
employer wants me to crank something out which at first seemed like a
piece of cake but I realize now I should have done a little more
research before I got started. Here is the issue:

I have a table with data relating to our pastry products. I built a
form with multiple combo boxes that are limited by category etc so that
the pastry chef can use the form to create his production schedule for
the week. This worked great and he can print the schedule. But now I
want to save the schedule as a record in another table so that next
week when he goes to do the schedule, he can see what he did the week
before.

Everything I read seems to discuss how to create a form to ENTER data
to the table it is associated with. But not how to take the data
selected in the form and to save it to another table. Any help will be
thoroughly appreciated.

Tara


Hi Tara,

The code that you need is:

Public Function WriteDetails()
Dim rsRead As New ADODB.Recordset
Dim rsWrite As New ADODB.Recordset
Dim sql As String
sql = "Detail1, Detail2, Detail3, Detail4, Detail5 "
sql = sql & "FROM tblPastry"
rsRead.Open sql, CurrentProject. AccessConnectio n,
adOpenForwardOn ly, adLockOptimisti c
sql = "SELECT Field1, Field2, Field3, Field4, Field5 "
sql = sql & "FROM tblTable1"
With rsWrite
.Open sql, CurrentProject. AccessConnectio n, adOpenDynamic,
adLockOptimisti c
.AddNew
!Field1 = rsRead!Detail1
!Field2 = rsRead!Detail2
!Field3 = rsRead!Detail3
!Field4 = rsRead!Detail4
!Field5 = rsRead!Detail5
.Update
.Close
End With
Set rs = Nothing
End Function

Where the detail rows are the data that you have, and the Fields you
will have to create manually, but will be updated automatically. This
is how to do it using ADO but if you are from a SQL Server background
why do you not write an append query that references a form for the
date or some other unique number?


Addendum

The end of the code in the preceeding example should read:

.Update
.Close
End With
Set rsRead = Nothing
Set rsWrite = Nothing
End Function

Thankyou

Jun 21 '06 #3

Nick 'The Database Guy' wrote:
tarafinlay wrote:
Hi all,
I am new to access and am finding it a bit unintuitive having worked
with SQL server in the past... And I am in a bit of a hurry because my
employer wants me to crank something out which at first seemed like a
piece of cake but I realize now I should have done a little more
research before I got started. Here is the issue:

I have a table with data relating to our pastry products. I built a
form with multiple combo boxes that are limited by category etc so that
the pastry chef can use the form to create his production schedule for
the week. This worked great and he can print the schedule. But now I
want to save the schedule as a record in another table so that next
week when he goes to do the schedule, he can see what he did the week
before.

Everything I read seems to discuss how to create a form to ENTER data
to the table it is associated with. But not how to take the data
selected in the form and to save it to another table. Any help will be
thoroughly appreciated.

Tara


Hi Tara,

The code that you need is:

Public Function WriteDetails()
Dim rsRead As New ADODB.Recordset
Dim rsWrite As New ADODB.Recordset
Dim sql As String
sql = "Detail1, Detail2, Detail3, Detail4, Detail5 "
sql = sql & "FROM tblPastry"
rsRead.Open sql, CurrentProject. AccessConnectio n,
adOpenForwardOn ly, adLockOptimisti c
sql = "SELECT Field1, Field2, Field3, Field4, Field5 "
sql = sql & "FROM tblTable1"
With rsWrite
.Open sql, CurrentProject. AccessConnectio n, adOpenDynamic,
adLockOptimisti c
.AddNew
!Field1 = rsRead!Detail1
!Field2 = rsRead!Detail2
!Field3 = rsRead!Detail3
!Field4 = rsRead!Detail4
!Field5 = rsRead!Detail5
.Update
.Close
End With
Set rs = Nothing
End Function

Where the detail rows are the data that you have, and the Fields you
will have to create manually, but will be updated automatically. This
is how to do it using ADO but if you are from a SQL Server background
why do you not write an append query that references a form for the
date or some other unique number?


Addendum

The end of the code in the preceeding example should read:

.Update
.Close
End With
Set rsRead = Nothing
Set rsWrite = Nothing
End Function

Thankyou

Jun 21 '06 #4
Hi Nick,
Thanks for your reply! The issue is really that I don't know how to
make the button do something :) I assume that I would assign this code
to the button to save the record? Forgive my ignorance...
Tara

Nick 'The Database Guy' wrote:
tarafinlay wrote:
Hi all,
I am new to access and am finding it a bit unintuitive having worked
with SQL server in the past... And I am in a bit of a hurry because my
employer wants me to crank something out which at first seemed like a
piece of cake but I realize now I should have done a little more
research before I got started. Here is the issue:

I have a table with data relating to our pastry products. I built a
form with multiple combo boxes that are limited by category etc so that
the pastry chef can use the form to create his production schedule for
the week. This worked great and he can print the schedule. But now I
want to save the schedule as a record in another table so that next
week when he goes to do the schedule, he can see what he did the week
before.

Everything I read seems to discuss how to create a form to ENTER data
to the table it is associated with. But not how to take the data
selected in the form and to save it to another table. Any help will be
thoroughly appreciated.

Tara


Hi Tara,

The code that you need is:

Public Function WriteDetails()
Dim rsRead As New ADODB.Recordset
Dim rsWrite As New ADODB.Recordset
Dim sql As String
sql = "Detail1, Detail2, Detail3, Detail4, Detail5 "
sql = sql & "FROM tblPastry"
rsRead.Open sql, CurrentProject. AccessConnectio n,
adOpenForwardOn ly, adLockOptimisti c
sql = "SELECT Field1, Field2, Field3, Field4, Field5 "
sql = sql & "FROM tblTable1"
With rsWrite
.Open sql, CurrentProject. AccessConnectio n, adOpenDynamic,
adLockOptimisti c
.AddNew
!Field1 = rsRead!Detail1
!Field2 = rsRead!Detail2
!Field3 = rsRead!Detail3
!Field4 = rsRead!Detail4
!Field5 = rsRead!Detail5
.Update
.Close
End With
Set rs = Nothing
End Function

Where the detail rows are the data that you have, and the Fields you
will have to create manually, but will be updated automatically. This
is how to do it using ADO but if you are from a SQL Server background
why do you not write an append query that references a form for the
date or some other unique number?


Jun 21 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
11108
by: avinash | last post by:
hi myself avi i am developing one appliacaion in which i am using vb 6 as front end, adodb as database library and sql sever 7 as backend. i want to update one table for which i required data from other table. and iretrive data from second table by giving some condition. when i get data, then to update first table i need to use do while loop. instead of that i want to use select statement directly in update query. plz give me some help....
4
19809
by: intl04 | last post by:
How do I create a data input form in Access that is external to the Access database to which it's connected (if that's possible, which I believe it is)? For example, if someone clicks on an Access file icon on a computer desktop, it will open up a data entry form (that was created in Access). That way, the people who enter the data won't have direct access to the database at any point. I've seen that this can be done, but I don't know...
25
10223
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
0
2013
by: Jason | last post by:
I have a primary form which is used to enter/edit data in a table named Test_Results. On this primary form there is a subform which displays site addresses. This subform is linked to the primary form by field named TestID. The subform is used just for displaying site address data, data which is stored in another table named Total_Site_Address. In the Total_Site_Address table there are numerous fields that form the site addresses...
3
2938
by: CAD Fiend | last post by:
Hello, Well, after an initial review of my database by my client, they have completely changed their minds about how they want their form. As a result, I'm having to re-think the whole process. My Current Form (6 tabs): - Owner, Property, Title, Docs, Queries, & Reports - User is able to see (while navigating through the tabs) above in the form : Owner Name, Address, Parcel, and SSN
18
3338
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those columns, "scode" and "sname", as 1 column (if not possible then 2 columns will be fine) in the listbox. Can the listbox display 2 columns information from the dataset and how can I do that? Also, I set the property of the listbox to selectionmode...
3
2559
by: D. Shane Fowlkes | last post by:
Sorry for the length of this post. I have created a rather complex form which has a header/line item (parent and child records) structure. It's for an intranet. A screenshot can be seen here: http://www.drpt.virginia.gov/temp1.gif All the fields on this form have validation controls on them so they can not submit the form unless all fields are completed and some fall within a specified numeric range. When the form first is loaded,...
6
4840
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID SalesManName AT Alan Time
13
6774
by: ricky.agrawal | last post by:
I'm really not sure how to go about this in Access. What I've created is a table for each location. Those tables are identical in format but different in information. The tables are named after key points such as the store number and the store ID. The fields of those tables are generic fields such as sales per day, bank deposit and what not. The first field for each store table is the date and I've set that as the primary key as one...
0
8474
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8597
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8669
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4403
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2809
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.