access-vba

VBA: Reverse an array?

自闭症网瘾萝莉.ら 提交于 2020-01-05 04:07:13
问题 How could I reverse an array that is full of integers e.g.: [1;5;8;45;54] To: [54;45;8;5;1] Are there any built in functions I could use? I tried using this method: Array.Reverse(arr) I added Mscorlib.dll from Tools > References, but it showed error: Syntax error. At the Array.Reverse(arr) location. 回答1: Array.Reverse sounds like VB.Net, not VBA. Chip Pearson has functions for just about anything you will want to do with arrays (and other structures). http://www.cpearson.com/excel/vbaarrays

Run a macro with embedded Excel sheet in Access

坚强是说给别人听的谎言 提交于 2020-01-05 03:32:34
问题 My problem is quite simple but I haven't found a solution so far... I created a form in Access called Form1. In this form, I inserted an "Unbound Object Frame", which is a new macro-enabled Excel worksheet. In the Excel sheet, I create a macro we can call "ExcelMacro". I want to know how to run macros in this Excel sheet from Access, e.g. in my Access macro, run "ExcelMacro" I do NOT want to link my Excel sheet to an external Excel workbook. Do you have any ideas? Thanks a lot for your help!

How to run an append query in ms access vba as part of a transaction

三世轮回 提交于 2020-01-04 15:33:12
问题 I'm very new to programming and have been building my company's inventory database on MS Access 2016. I've been able to get by just fine with macros so far, but I'm trying to run a transaction made of append and delete queries and am struggling with the vba code. I figured out how to run a transaction where the queries fail on error. However, the append query I'm trying to include in the transaction is drawing values from a blank form, and as far as I can figure out, that means I need to

how to auto center objects in a form in access 2007?

久未见 提交于 2020-01-04 09:25:47
问题 I do not know in designing forms I set objects in center of and set the properity to auto center, but in form view when maximize the form objects go to the top left of the form, Can anyone help me,Please? 回答1: Access forms have an On Resize event where you can adjust the horizontal location of various controls on the form by manipulating their .Left properties based on the .Width properties of the form itself. For example, say I have a form with a Command Button named Button0 . To keep it

Two ways to execute a Stored procedure in VBA, Which one is better?

时间秒杀一切 提交于 2020-01-04 04:05:00
问题 Background: Work on frontend Ms-Access 2010 and backend SQL server 2008 Managment Studio For executing stored procedures I have been using a pretty lengthy process as seen here: in VBA Set Conn = New ADODB.connection Conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;....." Conn.Open Set cmd = New ADODB.Command cmd.ActiveConnection = Conn cmd.CommandType = adCmdStoredProc cmd.CommandText = "upGetTestIdForAnalyte" cmd.Parameters.Append cmd.CreateParameter("@WOID", adVarChar,

Two ways to execute a Stored procedure in VBA, Which one is better?

好久不见. 提交于 2020-01-04 04:03:54
问题 Background: Work on frontend Ms-Access 2010 and backend SQL server 2008 Managment Studio For executing stored procedures I have been using a pretty lengthy process as seen here: in VBA Set Conn = New ADODB.connection Conn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;....." Conn.Open Set cmd = New ADODB.Command cmd.ActiveConnection = Conn cmd.CommandType = adCmdStoredProc cmd.CommandText = "upGetTestIdForAnalyte" cmd.Parameters.Append cmd.CreateParameter("@WOID", adVarChar,

filter a query based on multiple list boxes in a form

旧巷老猫 提交于 2020-01-04 01:58:06
问题 I have an Access database with two tables: "contacts" and "country" These contain a number of fields in each. I have a query, "Filter", that brings these two tables together. I want to create a form with as many list boxes as there are fields in the query. A user can open the form and select multiple data from each list box - the row sources are tied back to the two tables above. Then on the click of a button the query would be displayed and filters would be applied dependent on the users

Parse XML File with VBA

徘徊边缘 提交于 2020-01-03 21:08:08
问题 I have a XML file with a structure similar to this: <egh_eval> <eval_set> <eval_id>FLOAT</eval_id> <eval_d> <height>INT</height> <weight>INT</weight> </eval_d> <eval_e> <height>INT</height> <weight>INT</weight> </eval_e> <eval_cred> <credit>FLOAT</credit> </eval_cred> </eval_set> I need to parse the complete file and put it in a table. (Note: eval_d and eval_e actually have more than a hundred attributes each). I tried using MSXML2 however I get stuck when I try to parse the file. By using

How to hide columns in a ComboBox dropdown?

北慕城南 提交于 2020-01-03 15:55:23
问题 I'm building a ComboBox in an Excel userform that gets its rows from an Access table. I want to display several text fields to the user in the dropdown, but the value returned from the ComboBox should be the ID number associated with the row that the user selects (i.e. the ID column is the bound column). But I don't want to show this ID number to the user. Is there a way to hide a column in the ComboBox's dropdown, but still have that column be bound? 回答1: If you have three columns - the

MS Access Form where user name is selected from list

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-03 06:18:11
问题 I am going to rephrase a previous question that I had posted: I have built a form in access that allows users to enter in their hours worked by activity (i.e. transactional processing, project time, vacation etc.). The fields on the form are: 1) user name 2) start date 3) end date 4) activity 5) hours spent Is there a way to have this form in such a way that when it is opened up by a user, a prompt automatically appears that forces you to select the user name from a list of users? Than once