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've 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 DaysToCompletion() As Long
'Opening tblContracts as recSet1 and recSet2
Dim con1 As ADODB.Connection
Dim con2 As ADODB.Connection
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 "tblContracts", 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
'"tblWhateverYourTableNameIs", con1 which means
'connection1 and then to open a field in that recordset you type
'recSet1.Fields("fieldname"))
x = 0
recSet1.MoveFirst
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.MoveNext
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
0 1052 Sign in to post your reply or Sign up for a free account.
Similar topics
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....
|
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...
|
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....
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
|
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,...
| |