473,756 Members | 3,499 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exporting the results of a module into an already created field in another table

153 New Member
Okay so the following is a question I posted earlier...to clarify what I'm trying to do here...I simply want the printed output to be put into a new field in a different table that's already created as recSet2...I'm assuming this is relatively simple and my syntax just is incorrect or perhaps the way I'm opening my connections allows for a read only connection? Any help would be much appreciated. Thanks.


Hey guys...the following code doesn't seem to work refering to the line

Quote:
Originally Posted by
recSet2.Fields( "DateDifference ") = UntilCompletion


It says the field is not updatable...I'v e never updated a table from a module before so I'm not sure if I am doing this right but the code is pasted below (the variable 'x' has nothing to do with anything as of now, it's something I will need later)(also no need to read the commentary it's more for my own purposes since this is still a learning experience for me):

Quote:
Originally Posted by
Public Function DaysToCompletio n() As Long

'Opening tblContracts as recSet1 and recSet2
Dim con1 As ADODB.Connectio n
Dim con2 As ADODB.Connectio n
Dim recSet1 As ADODB.Recordset
Dim recSet2 As ADODB.Recordset
Set con1 = CurrentProject. Connection
Set con2 = CurrentProject. Connection
Set recSet1 = New ADODB.Recordset
Set recSet2 = New ADODB.Recordset
recSet1.Open "tblContrac ts", con1

recSet2.Open "tbldtdiff" , con2
Dim x As Long

'Declaring UntilCompletion as the amount of days until completion
Dim UntilCompletion As Long

'Looping until EOF (until the last record for EndDate in tblContracts... so
'someone else would have declared recSet1.Open
'"tblWhateverYo urTableNameIs", con1 which means
'connection1 and then to open a field in that recordset you type
'recSet1.Fields ("fieldname" ))
x = 0

recSet1.MoveFir st
Do Until recSet1.EOF
' End Date must be in quotes or will not work
UntilCompletion = DateDiff("d", Date, recSet1.Fields( "EndDate"))
Debug.Print UntilCompletion
recSet2.Fields( "DateDifference ") = UntilCompletion
recSet1.MoveNex t
x = (x + 1)
Loop

'Clearing recSet1 and Con1 (Connection1)
recSet1.Close
recSet2.Close
con1.Close
con2.Close
Set con1 = Nothing
Set con2 = Nothing
Set recSet1 = Nothing
Set recSet2 = Nothing

End Function
Dec 18 '06 #1
0 1069

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

Similar topics

12
9872
by: Larry Bates | last post by:
I'm trying to get the results of binascii.crc32 to match the results of another utility that produces 32 bit unsigned CRCs. binascii.crc32 returns results in the range of -2**31-1 and 2**21-1. Has anyone ever worked out any "bit twiddling" code to get a proper unsigned 32 bit result from binascii.crc32? Output snip from test on three files: binascii.crc32=-1412119273, oldcrc32= 2221277246
6
3698
by: Kevin Chambers | last post by:
Hi all-- In an attempt to commit an Access MDB to a versioning system (subversion), I'm trying to figure out how to convert a jet table's metadata to text, a la SaveAsText. The end goal is to be able to build an MDB completely from the svn repository text files. Has anybody dealt with this? Thanks in advance,
9
3062
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped. Below you will find the code I've written and the error that results. I'm hoping that someone can give me some direction as to what syntax or parameter is missing from the code that is expected by VBA. Overview: I'm trying to copy calculated...
6
8228
by: sara | last post by:
I have what I think is a little strange...I have to get data from our payroll system into a specific format (fixed record length) as a .txt or .prn file only to upload to our 401k custodian. I can get the data into Access (from Payroll) and write a query with all the fields (inserting fields with spaces, as needed), but I can't figure out how to get it to export to a .txt file - without the field name header row. I don't really ...
0
10032
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
9872
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
9841
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
8712
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...
0
6534
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
5141
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
5303
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3805
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
2
3358
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.