ms-access-2013

Combobox null in if statement

☆樱花仙子☆ 提交于 2019-12-10 01:57:08
问题 I am trying to code an if statement where if a certain combobox is null, then it runs a certain part of code if it has data in it then it runs another. I wrote up this: Private Sub ProjectAddSetDateAutoBtn_Click() If ProjectAddAllDueDateAutoCmBx = Null Then 'Code1 Msgbox("ComboBox Is Null") Else 'Code2 Msgbox("ComboBox Has Data") End If End Sub I leave the combobox with no data, and then it doesn't run the code in the first part of the if or the code in the 2nd part of it either! If I enter

Inserting data from a form into a table

梦想与她 提交于 2019-12-09 03:52:34
问题 it's been probably 3 years since I have had to use VB or VBA code. I am working on a project for work where I need to take the information that is listed on the form and insert it into a table. What I am stuck on is the last part of the code the values part. This is what I have so far. INSERT Volunteers (Name, Email, Number, Emergency Contact, Emergency Number) VALUES (and this is where I get stuck) Thank you all in advance! 回答1: INSERT Volunteers (Name, Email, Number, Emergency Contact,

How to search through Access macros?

拟墨画扇 提交于 2019-12-08 09:33:51
问题 My Access database has a query which, I suspect, is called by macros or other queries. Is there any way to run a Find on the "code" of all the macros and/or queries, to look for a text string (in this case, the query name)? 回答1: this lists all the tables & queries: SELECT IIf([type] = 5, "Query", "Table") AS [Object type] ,MSysQueries.Flag AS [Query type] ,MSysObjects.NAME ,MSysObjects.Id ,MSysObjects.Type FROM MSysObjects LEFT JOIN MSysQueries ON MSysObjects.Id = MSysQueries.ObjectId GROUP

Date Format changes when inserting into table if start date and end date cross one or more months

◇◆丶佛笑我妖孽 提交于 2019-12-06 14:23:24
问题 I have an Access 2013 form which has two unbound date fields, FromDate and ToDate. I insert these into a table (TblGuestBooking) which has an autonumber key field, so this doesn't feature in the SQL statement to follow. If the FromDate and ToDate are in the same month, the dates are entered as dd/mm/yy, the format of the form field. If, however, the From date is in one month and the to date is in the next month or later month, the format changes to mm/dd/yy for the subsequent months. for

Calculating time difference between activity timestamps in a query

爱⌒轻易说出口 提交于 2019-12-06 12:01:33
I'm reasonably new to Access and having trouble solving what should be (I hope) a simple problem - think I may be looking at it through Excel goggles. I have a table named importedData into which I (not so surprisingly) import a log file each day. This log file is from a simple data-logging application on some mining equipment, and essentially it saves a timestamp and status for the point at which the current activity changes to a new activity. A sample of the data looks like this: This information is then filtered using a query to define the range I want to see information for, say from 29/11

Runtime error 429 in VBA, but class is registered

人盡茶涼 提交于 2019-12-06 09:56:59
问题 I'm trying to recreate a program that uses javascript to open a connection to a PLC and then display all sorts of information on a web page. I'd rather have it in a form in MS Access for various reasons, and have spent forever trying to find the right dll to use (Jet32X.dll, if anyone is curious). I finally tracked the CLSID called out in the javascript back to a registered class for the PLC, and I'm trying to create that object in VB code. It won't get any further than the Dim As New line,

VBA calculate MD5 hash on file contents

六眼飞鱼酱① 提交于 2019-12-06 04:42:22
I need a VBA routine to calculate the MD5 hash of a file's contents. I located some examples (e.g., here ) but I found that they crashed when the filename contained certain Unicode characters, so I am trying to tweak the code to avoid that. This code does not result in an error, but it also doesn't return the correct MD5 hash. What's wrong? Public Function FileToMD5Hex(sFileName As String) As String Dim enc Dim bytes Dim outstr As String Dim pos As Integer Set enc = CreateObject("System.Security.Cryptography.MD5CryptoServiceProvider") 'Convert the string to a byte array and hash it bytes =

Adding Trusted Location to Access Run Time

廉价感情. 提交于 2019-12-06 02:17:00
问题 I have created a runtime access file, how do I add this file to Trusted Location on my clients PC, where there is No Access Installed. 回答1: Access 2007: [HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security\Trusted Locations] [HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security\Trusted Locations\Location(n)] Access 2010: [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security\Trusted Locations] [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access

Access 2013 VBA - Setting New Click Event for Controls

亡梦爱人 提交于 2019-12-05 08:27:49
I have searched everywhere for this, and it seems like a simple fix, but I can't seem to find the solution. I have several Rectangle controls in my Access 2013 form, and I'm creating an OnClick event that handles them all. I've worked on a few different methods, and I think I found the simplest/cleanest way to do it. I put the controls in a collection and change the OnClick event for each control. Here's my problem: Access opens the form and recognizes that I changed the event for the control, but once I click the control, it throws an error and will not execute the event. The Error: "The

Collection Object - ByRef - ByVal

谁说胖子不能爱 提交于 2019-12-05 03:00:19
问题 I am using VBA in Access 2013. In a regular module there are 2 procedures, RunProc() and PopulateCollection() When RunProc is executed it calls PopulateCollection where the argument passed is an Collection instace named MyCol . PopulateCollection adds 3 items and then RunProc continues by iterating the Collection. My question / problem is this: I want the argument MyCol in RunProc to NOT be populated by PopulateCollection . What is the proper way to accomplish this? Why does