access-vba

How to pass an array to a function in VBA?

*爱你&永不变心* 提交于 2019-12-31 11:36:08
问题 I am trying to write a function that accepts an array as an argument. The array can have any number of elements. Function processArr(Arr() As Variant) As String Dim N As Variant dim finalStr as string For N = LBound(Arr) To UBound(Arr) finalStr = finalStr & Arr(N) Next N processArr = finalStr End Function Here is how I try to call the function: Sub test() Dim fString as string fString = processArr(Array("foo", "bar")) End Sub I get an error saying: Compile Error: Type mismatch: array or user

How to get windows username in MS Access VBA on Windows Server 2008

穿精又带淫゛_ 提交于 2019-12-31 05:13:06
问题 I am using this code in my MS Access VBA: How to get logged-in user's name in Access vba? It works perfectly fine. However, our foreign employees need to use the software on a server, and it is unable to retrieve the username. We are signed in as usual. The server version is Windows Server 2008 SP2. Any suggestions? Best regards, Emil. 回答1: I don't know which method you are using (there are several answers), but this one suggested by HansUp is easy and hopefully works on the Server too: https

scrape data from web page source where url doesn't change

爷,独闯天下 提交于 2019-12-31 05:05:32
问题 I need to do the following Go to http://healthapps.state.nj.us/facilities/acSetSearch.aspx?by=county Select " Special Hospital " and " All Ambulatory Care Facilities **NOTE #2 " Click SEARCH Loop through all the hospitals in the list Click on each hospital Get some data from the hospital page I have 2 problems I don't know how to select the " Special Hospital " and " All Ambulatory Care Facilities **NOTE #2 " When I manually select those 2 types and then click on some of the hospitals, the

Access VBA merging Word template with query

北慕城南 提交于 2019-12-31 04:18:25
问题 I want to create a template in Word, that I can then use Access to merge data into. The Access data has various levels of grouping. Within each grouping, there are subqueries that may also have grouping. Because there is grouping, certain pages will need to be repeated. Example: I have a query that prints the details of a classroom. There are many students in each classroom, as well. So, I would like to have a DOTM template that groups each student by class. Then prints the first class

Query not updateable

家住魔仙堡 提交于 2019-12-31 03:48:10
问题 I am trying to update local Access 2007 table with records from BE SQL Server 2012 Express. My steps here: In SQL Server exists Stored Procedure with 4 parameters to get needed records; In Access VBA there is function to call SP and make temporary query: Public Function UpdateLocalSQLTable(strTable As String, strSQL As String, strSQL1 As String) As Boolean On Error GoTo Err_Handler Dim qdf As DAO.QueryDef Dim strQuery As String Dim conConnectString As String strQuery = "qryTemp" DoCmd.Close

Access - Hyperlinks Aren't Linking

混江龙づ霸主 提交于 2019-12-31 03:05:12
问题 I have a form with a user created function (See here for function: Adding a file browser button to a MS Access form) to pull a folder path name into a text box. Ideally, I want this text to become a hyperlink that can be opened from a query. However, for all records I have added from the form the hyperlink is not working. I looked in "Edit Hyperlink" for the records and there is no address. Also, I had manually entered some records in before I had made the form and their hyperlinks worked

Access - Hyperlinks Aren't Linking

不羁岁月 提交于 2019-12-31 03:05:02
问题 I have a form with a user created function (See here for function: Adding a file browser button to a MS Access form) to pull a folder path name into a text box. Ideally, I want this text to become a hyperlink that can be opened from a query. However, for all records I have added from the form the hyperlink is not working. I looked in "Edit Hyperlink" for the records and there is no address. Also, I had manually entered some records in before I had made the form and their hyperlinks worked

How to add a calculated column to Access via SQL

本小妞迷上赌 提交于 2019-12-31 01:45:11
问题 How do i add a calculated column to an Access table in SQL? I know i can add a column with SQL like this: ALTER TABLE Clients ADD COLUMN AccountDate TEXT(60) Thanks, Vítor 回答1: You cannot add a calculated column with SQL because calculated field requires an expression and that cannot be supplied through SQL. Technically, a calculated field is a base type - int, double, text etc. Above the base type is an expression that helps Access do the math/logic. You could use VBA to create a calculated

How do I display a messagebox with unicode characters in VBA?

二次信任 提交于 2019-12-30 18:45:08
问题 I have a string containing unicode characters in VBA. I want to display that string in a message box containing it. However, instead of the string, the message box only contains a questionmark. MCVE: Dim s As String s = ChrW(5123) MsgBox s 回答1: MsgBox is not compatible with non-ANSI unicode characters. We can display message boxes with the WinAPI MessageBoxW function, however, and that is . Let's declare that function, and then create a wrapper for it that's nearly identical to the VBA MsgBox

Creating one table from data of another table in Access

一笑奈何 提交于 2019-12-30 12:38:21
问题 This question is regarding MS Access. What I'm trying to do is that I have one table in Access, and would like to create another table (hopefully automatically through some VBA code) using data from the first table. Is there any suggestion on how to do this? I'm quite new in VBA and Access so any detailed help would be appreciated (or direction on where to go). Original Table (table 1 Data): Original Table (table 1 structure): Table 2 Data: Table 2 Structure: 回答1: No VBA is needed. A UNION