recordset

Deep Copy or Clone an ADODB recordset in VBA

邮差的信 提交于 2019-12-17 15:57:18
问题 I have been searching for a way of duplicating or copying a recordset in VBA. And by that I mean, having the undelying data independent of each other. I have tried Set copyRS = origRS.Clone Set copyRS = origRS When I use any of the methods I cant modify one recordset without modifying the other. So in this example: I create a recordset I populate the recordset with the name John I clone the recordset I modify the cloned one Check result Code: Dim origRS As Recordset, copyRS As Recordset Set

VBScript - Return a Recordset in an Array (SQL Like function)

£可爱£侵袭症+ 提交于 2019-12-14 04:19:56
问题 I have to write a program for my company's accountant, and I have a problem in returning articles' families in an array, all of the families I want to have have an Accounting code who begins with "707". Here's my code in VBScript : Set objConnection = CreateObject("ADODB.Connection") Set rs = CreateObject("ADODB.Recordset") objConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\BASES\Base.mdb;Persist Security Info=False" rs.CursorLocation = adUseClient FamilleQuery = "Select Code

ADODB recordset in VBA says excel field is empty when it's not

孤者浪人 提交于 2019-12-14 02:51:45
问题 I have an excel sheet I need to import in my Access database. The sheet looks like this: DATE RECEPTION DENOMINATION ITEM N° QUANTITE RECUE 06/01/2010 DVD-Sex & the City PCR-PA21550167 5 06/01/2010 DVD-Avatar Natie 2 PCR-PA21550209 10 I then transfer this file into the database using adodb: Dim rs2 As New ADODB.Recordset Dim cnn2 As New ADODB.Connection Dim cmd2 As New ADODB.Command Dim intField As Integer Dim strFile As String strFile = fncOpenFile If strFile = "" Then Exit Sub With cnn2

Excel VBA report building

微笑、不失礼 提交于 2019-12-13 08:33:32
问题 I've been working on creating a dynamic report in MS Excel. I'm working on a legacy VB6 application and I've come across a few issue that I hope ya'll can help me resolve. What I'm doing below, is grabbing data into my recordset g_RS3 - typically this has anywhere from 3 to 20 items, and I use g_RS3 to enter values (headings, and 2 column values under each heading: clients, buyers) into my excel spreadsheet. I'm trying to make an edit to it but I've been struggling with it. This is my code...

VBA ADODB update recordset

妖精的绣舞 提交于 2019-12-13 05:21:47
问题 I am trying to read the contents of two different tabs in a worksheet and compare them by using ADODB and querying techniques VBA. Below you can find my code: stCon = "Provider=Microsoft.Jet.OLEDB.4.0;" _ & "Data Source=" & wbBook.FullName & ";" _ & "Extended Properties=""Excel 8.0;HDR=YES;IMEX=1;Readonly = False"";" ' MsgBox (stCon) 'here is SQL code to gather data including our calculation from two tables within the workbook 'stSQL = "SELECT [Recon_Daily_Xml_report$].RECTYPEGLEDGER, [GL

How can I create a dialog in SAX that lets a user choose one item from a recordset?

安稳与你 提交于 2019-12-13 04:02:18
问题 I am new to programming. I'm trying to write a macro in a program called Captovation Capture. Basically this program is for scanning documents (usually forms of some kind), and then indexing them (by typing in metadata into fields). We currently use some macros (that were written by someone else) that will automatically fill some of the fields based on data entered in another field. For example, you can enter in an employee's (unique) number into the EMPLOYEE NUMBER field, and the macro will

MS Access OpenRedcordset reading wrong string

橙三吉。 提交于 2019-12-13 03:43:58
问题 General explanation: my query 2_Total returns a single value: Run the VBA function that exports the query to an excel file: Problem: OpenRecordset is not reading the correct query. My query should be exported to my excel file. Yet My VBA is pointing at wrong stuff. My guess is that the line qry.SQL = "SELECT * FROM [dbo_SO_SalesHistory]" is not providing sufficient information? SQL SELECT Sum(dbo_SO_SalesHistory.DollarsSold) AS SumOfDollarsSold FROM dbo_SO_SalesHistory WHERE (((dbo_SO

ADODB RecordSet as Access Report RecordSource

烈酒焚心 提交于 2019-12-12 08:48:02
问题 I have a simple form, a query and a report in Access 2003. I have to manipulate the results from the query in a recordset using VBA and then pass it on to the report as its RecordSource. If I declare the recordset as RecordSet and use its Name property as the RecordSource of the report then it is working. However, because I need to edit the recordset, I though it would be easier to use an ADODB RecordSet as below. The records set is declared as Dim rs As ADODB.RecordSet in a global module.

Moving through the Recordset in Access VBA

大兔子大兔子 提交于 2019-12-12 06:27:04
问题 I have a simple function using Excel VBA for calculating volatility. It takes as inputs a column of numbers (Zeros) and two dates. The code is: Function EWMA(Zeros As Range, Lambda As Double, MarkDate As Date, MaturityDate As Date) As Double Dim vZeros() As Variant Dim Price1 As Double, Price2 As Double Dim SumWtdRtn As Double Dim I As Long Dim m As Double Dim LogRtn As Double, RtnSQ As Double, WT As Double, WtdRtn As Double vZeros = Zeros m = Month(MaturityDate) - Month(MarkDate) For I = 2

Python to open ADODB recordset and add new record

假如想象 提交于 2019-12-12 03:45:18
问题 in my wxPython app which I am developing I have written a method which will add a new record into an access database (.accdb). I have procured this code from online search however am not able to make it work. Below is the code:- def Allocate_sub(self, event): pth = os.getcwd() myDb = pth + '\\myAccessDB.accdb' DRV = '{Microsoft Access Driver (*.mdb)}' PWD = 'pw' # connect to db con = win32com.client.Dispatch(r'ADODB.Connection') con.Open('DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=