access-vba

Loop through records and increment value in vba access

十年热恋 提交于 2019-12-20 07:34:08
问题 I'm trying to loop through records in a table with part no's and with matching part no's, increment a value in the pos field. I asked a question earlier(Object variable or With block variable not set Access vba) with the same project but for a different step of the process (running a query). I haven't found a question that addresses this problem in Access yet, but I have taken some pointers from this question: Code to loop through all records in MS Access . Now, I'm trying to write the code

Importing .xls to Access .mdb: External Table is not in the expected format

落爺英雄遲暮 提交于 2019-12-20 07:28:52
问题 I have a macro that imports a spreadsheet as follows: (this spreadsheet is an export from a web-based application, and during the initial export the chosen format is 97-2003) DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "d2s_safety_tbl", _ "\\company.com\dfsroot$\Share\office_public\D2S\D2S\D2S_Scorecard\Source Data\D2S\D2S Safety.xls", True When importing to Access, I get: Run-time Error '3274': External table is not in the expected format. When I open this Excel file, I get

Importing .xls to Access .mdb: External Table is not in the expected format

泄露秘密 提交于 2019-12-20 07:28:03
问题 I have a macro that imports a spreadsheet as follows: (this spreadsheet is an export from a web-based application, and during the initial export the chosen format is 97-2003) DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "d2s_safety_tbl", _ "\\company.com\dfsroot$\Share\office_public\D2S\D2S\D2S_Scorecard\Source Data\D2S\D2S Safety.xls", True When importing to Access, I get: Run-time Error '3274': External table is not in the expected format. When I open this Excel file, I get

Can we run Access macro without MS Access?

馋奶兔 提交于 2019-12-20 07:06:55
问题 I have created .mdb (Access macro) for client but problem is that they are migrating to Office365 so access will no be longer available for them. Can I run Access macro without MS Access? I have googled it, I found .MDE file can solve the problem, but I don't have idea about it. Is there any alternative option or .MDE file will be the solution? I'm a beginner in Access please let me know if any suggestions are available. Thanks in advance! 回答1: You can't. But Access is indeed available

Can't get the cascading combo boxes to work

只谈情不闲聊 提交于 2019-12-20 06:04:30
问题 I am trying to make cascading combo boxes but I can't seem to get it to work. For example, if I select a specific computer in the first combo box, then the second combo box should only show the HDD that is compatible with that computer. I also provided a link to the database that I have created. Can anyone help me out with this? I have 2 tables with the fields: tblComputer(Computer) tblHDD(HDD, Computer) cboxComputer Row Source: SELECT tblComputer.Computer FROM tblComputer; cboxHDD Row Source

Microsoft VBScript compilation error: Expected end of statement

风流意气都作罢 提交于 2019-12-20 06:03:19
问题 I am trying to insert some records into MS Access Table with the help of below VB Script. But when am trying to execute it, it's throwing Compilation error: Expected end of statement. Could someone please help me figure out where am I going wrong. Private Sub Form_Click() Dim dbs As DAO.Database Dim DbFullNAme As String DbFullName = "D:\G\Diamond\FINAL MS-Access\MS-Access project.accdb" Set dbs = OpenDatabase(DbFullName) dbs.Execute "INSERT INTO [2014_Status] ( Prompt, Project_Name, STATUS

Run access query from excel and pass paramerts to the query

风格不统一 提交于 2019-12-20 05:50:34
问题 How to execute a query in ms access db from Excel VBA code or macro. MS-Access query accepts some parameters, that needs to be passed from Excel. Thanks 回答1: Here is one possibility: Dim cn As Object Dim strFile As String Dim strCon As String Dim strSQL As String strFile = "C:\docs\Test.mdb" strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFile ''Late binding, so no reference is needed Set cn = CreateObject("ADODB.Connection") cn.Open strCon strSQL = "INSERT INTO ATable (AField)

How to get accurate LastUpdated date/time from objects in Access?

倖福魔咒の 提交于 2019-12-20 05:22:03
问题 I am trying to retrieve the LastUpdated date from Access objects and sometimes it is returning the DateCreated value. I am seeing the same results querying MSysObjects : SELECT MSysObjects.Name, Switch([Type]=5,'Query',[Type]=-32768,'Form',[Type]=-32764,'Report',[Type]=-32766,'Macro',[Type]=-32761,'Module') AS ObjectType, MSysObjects.DateUpdate FROM MSysObjects WHERE (((Left$([Name],1))<>'~') AND ((MSysObjects.Type) In (5,-32768,-32764,-32766,-32761))) ORDER BY MSysObjects.DateUpdate DESC; or

Read Excel file sheet names

回眸只為那壹抹淺笑 提交于 2019-12-20 05:17:11
问题 I have an export process that transfers data from my Access tables to an Excel File. A couple times I have had issues where the process didn't generate one or more of the sheets (1 sheet = 1 table) in Excel. So when the transfers are complete I want Access to check if all the sheets are located in the Excel file. I have most of the Check process worked out all I need now is a way to "read" the sheet names from the Excel File in to a table. How can I read the Sheet name (not the data)? 回答1:

Is there any downside to passing a recordset to functions instead of individual variables?

无人久伴 提交于 2019-12-20 04:53:24
问题 We have a single-user Access 2007 database that does things like send reports and update other databases on a timer ("events") -- one event at a time. As each event is executed, a one-row recordset is created with information that the event needs to run. I've been passing parameters to functions the usual way using individual variables but I'm wondering if would make sense to just pass the entire event recordset to each function and use whatever is needed for that function. Considering that,