access-vba

Connection string syntax for Classic ADO / ODBC / Oracle 10g EZConnect

我与影子孤独终老i 提交于 2019-12-18 20:16:12
问题 I'm trying to connect various VBA projects to an Oracle 10g back end using ADO (2.8) and no TNS. After various attempts, we've decided that the simplest series of steps for a clean installation include: Set up an Oracle Instant Client Install the accompanying ODBC driver (Test the connection using EZCONNECT via SQL Plus) (Test the connection by creating a Windows DSN) Everything up to here works fine. Problem is, I cannot figure out the syntax to tell ADO to use the instant client ODBC driver

How to search through VBA code files

南楼画角 提交于 2019-12-18 11:49:32
问题 I just started a job with a new company where previous developers had created many automated tasks. Of course, there is virtually no documentation and I didn't have a chance to work with the previous developer so now I'm trying to sift through all these processes looking for one that modifies some specific files. I've scripted all the stored procs in SQL and used a search tool and didn't find what I was looking for, so now I am wondering if the process I need is located in one of many Access

Progress bar in MS Access

孤街浪徒 提交于 2019-12-18 10:34:32
问题 I have a query running in Microsoft Access 2010 and it takes over 30 minutes to run normally. I would like to present the end user with some status of the query. A progress bar would be nice but not required. Access seems to be poorly threaded and locks up tight during the execution of the query, negating any updates I try. While I'd rather whip out VS and write my own app to do this, I'm forced to use Access. Any ideas? EDIT I used to run this from a batch script which populated the database

Manage quotes inside string VBA

♀尐吖头ヾ 提交于 2019-12-18 09:49:08
问题 I trying to insert to Access Table some values that I getting from another table, the problem is that some values comes with quotes and double quotes inside the string, like this example: str1 = "Non-fusible sectionalizing "green' low rise switch." How can I manage quotes inside string in VBA for Access 2010 for can insert it into table? 回答1: From memory I think you just need to double them up to look like this: str1 = "Non-fusible sectionalizing ""green' low rise switch." You can perform a

Time comparison in VBA: inequal while same time

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-18 09:29:25
问题 I'm moving a database from Microsoft Access to SQL server, and am validating data equality between the remote and the local table. While doing so, I encountered an oddity when comparing a time field. I'm using the following function: Public Function CheckAllFieldsEqual(rs1 As DAO.Recordset, rs2 As DAO.Recordset) As Boolean Dim fld As DAO.Field CheckAllFieldsEqual = True For Each fld In rs1.Fields If fld.Value <> rs2.Fields(fld.NAME).Value Then GoTo ReturnFalse Next fld Exit Function

Refresh MS Access Form/Query Based On Combobox Value

浪尽此生 提交于 2019-12-18 09:22:57
问题 Pretty simple explanation. I have a table with 10 entries, 5 entries with the year 2010 and 5 entries with 2011 in a column. In the query I have, I use Like *2010 to filter out all entries equal 2010 and display onl those records. On my form, I have combobox being populated with each unique year (from a different table). So my combobox values are 2010 and 2011. Is it possible, when I select say 2011, I trim the right 4 characters and use as my Like criteria to refresh and requery the form,

How to cancel a form close in Close Event?

情到浓时终转凉″ 提交于 2019-12-18 07:41:38
问题 I'm sure this is very simple, but I can't find it. In the close event of an Access Form, how can I cancel closing the form? I have a test that counts the records in a table. If that table has records, I want to ask the user if they want to close or go back and work with them. So how do I cancel the close event? 回答1: You can use the Unload event: GlobalVar ButtonClicked Private Sub Form_Open(Cancel As Integer) ButtonClicked = False End Sub Private ClickMe_Click(Cancel As Integer) ButtonClicked

“Save as…” dialog box in MSAccess vba: how?

*爱你&永不变心* 提交于 2019-12-18 07:25:10
问题 In MSAccess I've a mask with a button. When the user clicks on the button, the data in a table are exported on a .txt file: Private Sub Command_Click() Dim Rst As DAO.Recordset Dim AField As DAO.Field Dim TempStr As String Dim FileNumber FileNumber = FreeFile Open "c:\table.txt" For Output As #FileNumber Set Rst = CurrentDb.OpenRecordset("Tabella1", dbOpenForwardOnly) Do While Not Rst.EOF For Each AField In Rst.Fields If (AField.Name <> "ID") Then TempStr = TempStr & AField.value & " " End If

“Save as…” dialog box in MSAccess vba: how?

余生颓废 提交于 2019-12-18 07:25:09
问题 In MSAccess I've a mask with a button. When the user clicks on the button, the data in a table are exported on a .txt file: Private Sub Command_Click() Dim Rst As DAO.Recordset Dim AField As DAO.Field Dim TempStr As String Dim FileNumber FileNumber = FreeFile Open "c:\table.txt" For Output As #FileNumber Set Rst = CurrentDb.OpenRecordset("Tabella1", dbOpenForwardOnly) Do While Not Rst.EOF For Each AField In Rst.Fields If (AField.Name <> "ID") Then TempStr = TempStr & AField.value & " " End If

Python code for running ms-Access Module Subroutine

≯℡__Kan透↙ 提交于 2019-12-18 07:06:35
问题 I am very new to programming and this is my first question on stackoverflow. I am trying to make python open an .accdb file and run a subroutine which is already defined in Access. I manage to do it with Excel using this code: import win32com.client xl=win32com.client.Dispatch("Excel.Application") xl.Visible=True xl.Workbooks.Open(Filename="<mydirectory>\\open",ReadOnly=1) xl.Application.Run("TestMe") #...access spreadsheet data... xl.Workbooks(1).Close(SaveChanges=0) xl.Application.Quit() xl