473,666 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Moving Data from one RS to another RS

1 New Member
Hi Guys,

I'm very new to access and I've been trying to get the hang of it over the last few days, but I've become very confused with various aspects of how to code it.

Introduction:
I am using 3 tables for my data base at the moment. The first table is an ID table, which tracks IDs that are in use/taken. The second table is a queue, which has very little/limited information on a person. The third table is a log, which has much more data on a person. The user enters in the first name, last name, and telephone number and the data gets transferred from the queue table to the log table.


Goals:
-Move data from queue to log(make new entry in log).
-Assign new log entry an ID number, add ID entry to ID table.
-Delete entry from queue where the data had been taken from.



Code:

Private Sub MoveEntry_Click ()
Dim db As Database
Dim QD As QueryDef
Dim QD2 As QueryDef
Dim rsA As DAO.Recordset
Dim rsB As DAO.Recordset

'The 3 Primary Key Values for Both Tables that should be entered into the form

If IsNull(FirstNam eT) Then
MsgBox "Please Enter First Name", vbCritical, "Invalid First Name"
Exit Sub
End If

If IsNull(LastName T) Then
MsgBox "Please Enter Last Name", vbCritical, "Invalid Last Name"
Exit Sub
End If

If IsNull(PhoneT) Then
MsgBox "Please Enter Phone Number", vbCritical, "Invalid Phone Number"
Exit Sub
End If

Set db = CurrentDb()

On Error Resume Next
db.QueryDefs.De lete ("Move_Queue_Qu ery")
On Error GoTo 0

Set QD = db.CreateQueryD ef("Move_Queue_ Query", _
"Select Count(*) from [Call Queue] where [Last Name] = Me![LastNameT] AND [First Name] = Me![FirstNameT] AND [Phone Number] = Me![PhoneT];")
DoCmd.OpenQuery "Move_Queue_Que ry"

'ADD CODE HERE TO PROCESS COUNT

'ADD CODE TO SET ID
Set QD2 = db.CreateQueryD ef(Select Max(ID) from [ID Log])
'ADD CODE TO PROCESS MAX + 1
Set rsC = db.OpenRecordse t("ID Log")
rsC.AddNew
rsC("ID") = Max+1
rsC.Update
rsC.Close

'ADD CODE TO ACCESS CORRECT QUEUE ENTRY
Set rsA = db.OpenRecordse t("Call Queue")
Set rsB = db.OpenRecordse t("Call Log")
rsB.AddNew
rsB("ID") = ID
rsB("Date") = rsA("Date")
rsB("Time") = rsA("Time")
rsB("Last Name") = rsA("Last Name")
rsB("First Name") = rsA("First Name")
rsB("Phone Number") = rsA("Phone Number")
rsB("Notes") = rsA(Comments) + ", " + NotesT
rsB("Suggestion s") = SuggestT
rsB.Update
rsB.Close

'ADD CODE TO DELETE RECORD FROM rsA

rsA.Close
Set rsA = Nothing
Set rsB = Nothing
Set rsC = Nothing
Set db = Nothing

MsgBox "Added " + FirstNameT + " " + LastNameT, , "Success"
DoCmd.Close
End Sub



Known Problems:

So far, I do not know if I'm using QueryDefs right at all. But I have two in there.

The first one does a count to check if there exists an entry in the queue table that matches the first name, last name, telephone number. If this is a good way to do it so far, I need help on how to process the count. Is the querydef another table? Do I just grab the value? Or is there a way to store the count into a variable somewhere so I can just do a comparison statement like count ==1?

The second querydef does a max on the ID table to find out what the maximum value is. Similar to the first question, is there a way to store tha max into a value and then just add 1 to it and set that as the new ID number?

Next, accessing the correct record in the queue log to transfer information. Do I do that the same way I did the other querydefs? Is there a more effecient way to do it?

Lastly, I would like to understand how to delete the record I assessed from the queue table.



Thank you for reading this long problem. Any help would be greatly appreciated. I apoligize if some of these problems are routine and simple, I've tried looking on google but maybe I'm not typing in the right keywords
Dec 28 '06 #1
1 1938
NeoPa
32,568 Recognized Expert Moderator MVP
Let's forget this long complicated question and build up from scratch.
Precision and accuracy are very important in communicating remotely.
Q1. Do you have a form that an operator enters detail into which then populates the Queue table?
If not, please respecify the basic requirements without the necessity of working it out from your code.
We will need shortly, a post with your MetaData laid out.
Here is an example of how to post table MetaData :
Posting Table/Dataset MetaData
Expand|Select|Wrap|Line Numbers
  1. Table Name=tblStudent
  2. StudentID; Autonumber; PK
  3. Family; String; FK
  4. Name; String
  5. University; String; FK
  6. MaxMark; Numeric
  7. MinMark; Numeric
Dec 30 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
5497
by: Stephen Ghelerter | last post by:
I am moving a web site with a MySql database to another server. Can I create a database on the new server with the same name and then move the tables there, or is life not that simple? Or can I create tables with no data and then replace them with the files from the other server? I know I can export them as text files and them import them, but that is a lot of trouble. Also, using my FTP program I can't access the mysql folder on the...
2
1675
by: Todd D. Levy | last post by:
I am moving 3 fields & associated data from 1 table to another. I will have to make the necessary changes to forms, code, queries, & reports, etc. It is the reports, and the queries that they are based on that most concern me. Can I simply edit the existing queries to reflect the new locations of the fields in question, but otherwise leave the queries as is?
3
2063
by: genojoe | last post by:
I have tried everything I can think of to move records from one Access database to another. It should not be that hard. Read on.... I have identical access mdb's. One contains data; one contains empty tables. From an earlier posting, I was able to move the data by first exporting XML files and then importing them. I would like to find a way to skip the Import/Export steps. I first read the tables into a DataSet from the full...
3
3996
by: Iavor Raytchev | last post by:
Hello, We a situation with a central database that contains the data that needs to be presented at N off-line terminals (N can be 5 000 can be 15 000). Each terminal presents unique data. The central database is used for data preparation. Then the data for each terminal is exported as separate SQL file. The terminals run the same application that is used to prepare the data - only in user mode. So what we do is - we export the full database...
6
4905
by: Matt | last post by:
I'm not entirely sure how to describe this issue. I have a number of ComboBoxes in my application which have their text properties bound to a field in a data set. The items loaded in the ComboBox are not data bound (they just use the built in collection property of the ComboBox), and they are all set to use the DropDownList style. When moving from record to record via a BindingNavigator or a DataGridView (in master/detail format), the text...
3
1938
by: UJ | last post by:
I've got a working web service that we are moving to another machine and now I suddenly get the following error. While transferring the files, got the following message: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---System.InvalidOperationException: There is an error in XML document (1, 1422). ---System.Data.DataException: Undefined data type: 'anyType'. at System.Data.XSDSchema.FindNameType(String...
3
5645
by: jay.meerdink | last post by:
Greetings! I have a simple Windows form for editing. Search results are bound to a bindingsource and shown in a datagrid paired with a datanavigator. The current row's data is displayed in text boxes bound to the same bindingsource. I'd like to present a save / cancel dialog if the user changes the current data and attempts to navigate away from the current record. There's a ColumnChangingEvent on the underlying data object. I check...
1
2467
by: =?Utf-8?B?UmljaA==?= | last post by:
In a database search application (vb2005), the user wants to be able to scroll through records using the mousewheel. The data display form contains textboxes for the main data and a datagridview for the detail data for each main record. The form also contains btnBegining, btnPrevious, btnNext, btnEnd. In the btnNext.MouseWheel event I can increment/decrement the main data currencymanager position of the main dataset (depending on...
0
1915
by: jvitti | last post by:
I recently upgraded from Access 2000 to Access 2007 and I am having trouble with moving the focus from 1 form to another. While doing data entry if a similar claim is found the claim view form will open listing the similar claims. The data entry clerk can view 1 of the claims and by doubling clicking on the claim number some info from the claim view will be used to populate fields on the data entry screen. The following code is used...
15
2437
by: mcjason | last post by:
I saw something interesting about a grid pair puzzle problem that it looks like a machine when you find each that work out the way it does and say with all the others that work out the way they do together overlapping common pieces but say connected each working out as connected, but together as connected it's connected with the others connected. a whole machine where connected together is a condition of the machine together as...
0
8871
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
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
8551
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
8640
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...
1
6198
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
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.