vba

Changing Textbox.DefaultValue in Access

萝らか妹 提交于 2021-02-10 09:21:40
问题 I would like to be able to change the Textbox.DefaultValue during the 'On Load' event of a form such that each time the form is loaded the user is prompted with an InputBox to change a specific TextBox.Default value which in my case the TextBox control on the table is called Stream. I have tried the following code but each time it gives me a 'RunTime Error 3422 Cannot modify table structure. Another user has the table open'. Private Sub Form_Load() CurrentDb.TableDefs("Class 1 Students (C1)")

Access VBA - Open Form to Specific Record from Report

感情迁移 提交于 2021-02-10 07:47:04
问题 I have a report that lists Deposits, with the DepositID set as a hyperlink. OnClick of DepositID, it opens the Deposit Entry form to that particular record. However, the form opens to a new record instead of the one the user clicks on. I think it is because I have another bit of code that runs OnLoad of the form that goes to a new record, and it might be executing that after executing the OnClick code. OnClick of DepositID from the report: DoCmd.OpenForm "DepositForm", acNormal, "", "

Access Run time error - '-2147352567 (80020009)': subform

雨燕双飞 提交于 2021-02-10 07:01:22
问题 I've created a form where I can use a subform to load data from a query into textboxes so I can edit the data one at a time and update the database. This usually works fine except I have a run time error that randomly appears now and then - '-2147352567 (80020009)': The value you entered isn't valid for this field.' If I stop running it and try running it again it usually works fine until the same run-time error appears. It's very inconsistent. Private Sub btn_SelectAgency_Click() If Not (Me

How to looping rows and then columns in Excel

ε祈祈猫儿з 提交于 2021-02-10 06:53:02
问题 I have a table as shown below (B1:L7) Where A1 is lookup values , column B is the header , columns C to L are the data Here is what I intend to do with the macro: Loop the column B using the lookup values in A1 Once match, in example below, B6 shows matching values to A1 , the values of first 10 values (C to L) (i.e:row 6) are looped to show the values I have been rig up some macro as followed which it works correctly on step 1 Sub Looping_Click() 'Search columns Dim c As Range 'Search rows

Excel VBA running extremely slow after upgraded to Office365 ProPlus

China☆狼群 提交于 2021-02-10 06:38:10
问题 I paste part of the code as below. This code is to parse a JSON string got from HTTP request, there's no worksheet/workbook operation at all. Before office upgraded to office365 ProPlus, it's quite efficient. But after upgrade, a json which could be parsed less than 2 seconds, costs several minutes. Personally I don't understand the root cause. Code source: @Tim Hall https://github.com/VBA-tools/VBA-JSON/blob/master/JsonConverter.bas ' ============================================= ' ' Public

Excel macro to concatenate one row at a time to end of file

空扰寡人 提交于 2021-02-10 05:49:09
问题 I need an Excel macro to join seven columns of data on each row until the end of the data is reached. For example if I have a formula like this: =A1&B1&C1&D1&E1&F1&G1 How can I write the macro so that it increments for every row to the end of the file in a sequence like this? =A1&B1&C1&D1&E1&F1&G1 =A2&B2&C2&D2&E2&F2&G2 =A3&B3&C3&D3&E3&F3&G3 回答1: With so many answers, the main focus on what assylias and I were highlighting has gone to waste :) However, if you still want a VBA answer. Use this

VBA Excel Replace last 2 digits of number if occurs at beginning of string

好久不见. 提交于 2021-02-10 05:14:25
问题 I'm trying to replace the last two digits of number with " XX BLOCK " if it occurs at the start of the string and has more than 2 digits. I'm using the Microsoft VBScript Regular Expressions 5.5 reference. Dim regEx As New RegExp With regEx .Global = True 'Matches whole string, not just first occurrence .IgnoreCase = True 'Matches upper or lowercase .MultiLine = True 'Checks each line in case cell has multiple lines .pattern = "^(\d{2,})" 'Checks beginning of string for at least 2 digits End

VBA Excel Replace last 2 digits of number if occurs at beginning of string

守給你的承諾、 提交于 2021-02-10 05:14:13
问题 I'm trying to replace the last two digits of number with " XX BLOCK " if it occurs at the start of the string and has more than 2 digits. I'm using the Microsoft VBScript Regular Expressions 5.5 reference. Dim regEx As New RegExp With regEx .Global = True 'Matches whole string, not just first occurrence .IgnoreCase = True 'Matches upper or lowercase .MultiLine = True 'Checks each line in case cell has multiple lines .pattern = "^(\d{2,})" 'Checks beginning of string for at least 2 digits End

Mac Excel 2016 VBA - Workbook.open gives 1004 error

穿精又带淫゛_ 提交于 2021-02-10 05:12:55
问题 I'm trying to get a macro that works perfectly in Excel 2011 for Mac to work in Excel 2016 for mac. The goal is to have the user specify a folder with .csv files in it, and then the macro loops through all the .csvs, opening each to copy information out of it into another Workbook. The macro fails when trying to open the first .csv file in the user-chosen folder, with a 1004 error, file cannot be found. (side note: Earlier in the macro, workbooks.open works perfectly with a user selected FILE

Mac Excel 2016 VBA - Workbook.open gives 1004 error

旧巷老猫 提交于 2021-02-10 05:12:48
问题 I'm trying to get a macro that works perfectly in Excel 2011 for Mac to work in Excel 2016 for mac. The goal is to have the user specify a folder with .csv files in it, and then the macro loops through all the .csvs, opening each to copy information out of it into another Workbook. The macro fails when trying to open the first .csv file in the user-chosen folder, with a 1004 error, file cannot be found. (side note: Earlier in the macro, workbooks.open works perfectly with a user selected FILE