Forum Widgets
Latest Discussions
- SYAIFULNIZAMSHAMSUDIN-01Oct 31, 2024Copper Contributor141Views0likes0Comments
An obscure (low-severity) bug involving AutoKeys, MouseMove and RunCommand
Setup 1. Create a new database. 2. Create a new module with the following content: Function myPaste() DoCmd.RunCommand acCmdPaste End Function and save it as "Module1". 3. Create a new macro with the following content: Submacro: ^b RunCode =myPaste() and save it as "AutoKeys". 4. Create a new Form with - a text box "Text0" and - a button "myButton" and save it as "Form1". 5. Add two event handlers ([Event Procedure]) to myButton with the following code: Private Sub myButton_Click() Text0.SetFocus DoCmd.OpenForm "Form2" End Sub Private Sub myButton_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) ' Deliberately empty End Sub 6. Create a new Form with - a text box "Text0" and save it as "Form2". Repro Copy text into the clipboard (for example, the word "test"). Open Form1. Click on the button. Don't do anything after clicking the button. In particular, do not move the mouse for a few seconds (so that it still hovers over the space where the button was while the new form opens). Hit Ctrl-b Expected result Text0 in Form2 now contains the content of the clipboard. Actual result Text0 in Form1 now contains the content of the clipboard. Notes This bug is more of a curiosity than a real problem. It can be reproduced with the current channel of Microsoft 365 (v2409, 18025.20160) and with various older versions of 365, but not with Access 2007, so it was probably introduced at some time during the last 17 years. There are more important bugs to fix in Access, so it's probably not worth investing more time in it, but I still felt the need to document this issue. On workaround to prevent the bug from happening is to add an (empty) KeyDown handler to either Text0 in Form2 or, after enabling Key Preview, to Form2 itself. The MouseMove event handler on the button is required to reproduce the bug. We discovered this issue because our applications use a "Ctrl-v" AutoKey that sanitizes the clipboard (replace tabs with spaces, remove unprintable characters, replace line breaks with spaces if the target is a single-line textbox) before executing the paste operation. One might assume that Text0.SetFocus is part of the problem, but it isn't. It just helps to demonstrate the issue. If you remove it, Access will try to paste the text on the button in Form1 instead of the text box in Form2.HeinziATOct 17, 2024Brass Contributor110Views0likes0CommentsHow to Dynamically Control Debug.Print in MS Access VBA for Optimized Performance
Hello Microsoft Community, I’m Sasha Froyland, and I run an MS Access consultancy where we focus on optimizing performance while maintaining flexibility in debugging. I’ve recently developed a strategy for dynamically controlling Debug.Print to gain up to a 30% performance boost, which we use in our projects. What follows is this performance best practice that has helped us improve efficiency. Would a post like this be of interest to the community? If this isn't the appropriate place for such content, please accept my apologies in advance. My only goal is to facilitate communication and knowledge-sharing of best practices across the Access development space. Looking forward to hearing your thoughts! Below, please find the details of the best practice: At Help4Access, we know how important it is to balance performance with debugging. MS Access developers rely on Debug.Print to track their code, but excessive use can slow your application—sometimes by as much as 30%. To solve this, we’ve designed a dynamic method to enable or disable Debug.Print, giving you a performance boost without sacrificing debugging flexibility. Step 1: Global Variable for Control Start by adding a global variable: vba Copy code Public gDebugEnabled As Boolean This will allow you to toggle Debug.Print on and off globally in your app. Step 2: Configuration Table Create a system configuration table, tblSystemConfig, with a field DebugEnabled (Yes/No). This table will store the setting for whether Debug.Print is active. Step 3: Initialize on Startup At the start of your application, pull the DebugEnabled value into the global variable: vba Copy code gDebugEnabled = DLookup("DebugEnabled", "tblSystemConfig") Step 4: Conditional Debug.Print Wherever you use Debug.Print, wrap it in a conditional statement: vba Copy code If gDebugEnabled Then Debug.Print "Your debug message" Step 5: Real-Time Debugging Control You can toggle the DebugEnabled flag in your config table to turn debugging on or off, and then refresh gDebugEnabled—no need to restart the application. This gives you up to a 30% performance boost during production while retaining the ability to debug when necessary. By following this approach, you get both better debugging and improved performance. At Help4Access, we implement strategies like this to ensure that your Access applications run faster and more efficiently.Sasha_FroylandSep 14, 2024Copper Contributor391Views0likes0CommentsMicrosoft Access database engine 2016 driver
Greetings! I'm Nicolas Fischer, I'm working with Delphi and Microsoft Access Database 2016. Today, to connect the application written in Delphi with the database, we need to install the Microsoft Access database engine 2016 driver. However, when installing the driver, it ends up conflicting with older versions of Microsoft Office, just as installing older versions of Microsoft Office ends up conflicting with the 2016 driver. Is there any way to use the Access database without installing the driver? Maybe with some specific DLL or component for the connection? Thank you.nicolasfischerSep 05, 2024Copper Contributor442Views0likes0CommentsRunning my 32 bit access on a 64 bit computer works, But wont let me email !
I have moved my Database from a 32 bit operating systerm to a 64 bit computer. I am Running Microsoft Access Runtime 2013 and it operates my database just fine, Except when my database goes to send a email, It creates the pdf files then I get this error [ Active X component cant create object ] Thanks for any help , Bob This is part of my email code to Outlook: Dim myitem As Object Dim myout As Object Set myout = CreateObject("Outlook.Application") Set myitem = myout.CreateItem(0) With myitem .To = strMail .Cc = Nz(DLookup("EmailCC", "tblOwnerInfo", "OwnerID = " & lngID), "") .Bcc = Nz(DLookup("EmailBCC", "tblOwnerInfo", "OwnerID = " & lngID), "") .Subject = "Your Statement/Invoice" & " from " & Nz(DLookup("[CompanyName]", "tblCompanyInfo")) .Body = strBodyMsg .Attachments.Add myfile1 If ckbTerms = True Then .Attachments.Add myfile3 End If If mytot > 0 And ckbStateOnly = False Then .Attachments.Add myfile2 End If .Send End With Set myitem = Nothing Set myout = Nothing cbOwnerName.SetFocus Case Else Exit Sub End Select ExitProc:turniporangementionsAug 30, 2024Copper Contributor198Views0likes0CommentsVBA XMLHTTP Post Error 2147024891 (0x80070005) acces denied
I'm using a Microsoft Access application where I'm doing some POST Rest api to sharepoint httpObject As New XMLHTTP httpRequest = "<?xml version='1.0' encoding='utf-8'?>" & _ "<soap:Envelope xmlnsxsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" & _ "<soap:Body>" & _ "<GetCurrentUserInfo xmlns='http://schemas.microsoft.com/sharepoint/soap/directory/' />" & _ "</soap:Body>" & _ "</soap:Envelope>" soapAction = "http://schemas.microsoft.com/sharepoint/soap/directory/GetCurrentUserInfo" httpObject.Open "POST", servei_URL, False httpObject.setRequestHeader "Content-Type", "text/xml; charset=utf-8" httpObject.setRequestHeader "SOAPAction", soapAction httpObject.setRequestHeader "Connection", "Keep-Alive" httpObject.Send httpRequest This post method has an error result, because acces is denied. Before Internet Explorer was deactivated, this works perfectly, the application had the credentials and get some response. (Before, an Internet Explorer window was opened to log in Sharepoint. Now in these window appears a message like Internet Explorer is no longer available for Sharepoint) Now, I can't send the credentials into post method I tried to use WinHttpRequest and set the credentials into: Objecte_HTTP.setCredentials "domain\user", "password", 0 But I get a response within "Sign in to your account" PD: I have an active session logged in to EgdejoanmartinezAug 20, 2024Copper Contributor225Views0likes0CommentsMicrosoft Graph API Error from VBA Program
I am attempting to send an email with a large (>3MB) attachment from my Access VBA program using the Microsoft Graph API. I successfully created an upload session, but when I attempt to upload the attachment in chunks using this command: PUT "https://graph.microsoft.com/v1.0/me/messages/AAMkADliNzgzNTk2LWJhMjgtNDM2My1iZTEwLTk3YzBjNDY1ZmQwZQBGAAAAAADu4ZwpgbXiRKTp5qfhjGayBwAMcsdba53uQYkVwk8WbRoaAAAAAAEPAAAMcsdba53uQYkVwk8WbRoaAAbrs5ILAAA=/attachments/Onboarding_Guide_v12.pdf/createUploadSession" I receive an InvalidAuthenticationToken error. The token that I used was good enough to create the upload session, and I thought that Microsoft kept track of that via the message ID but it seems to somehow be requesting it. My VBA is below Sub UploadFileInChunks(uploadUrl As String, filePath As String) Dim fileData As String fileData = ReadFile(filePath) Dim fileSize As Long fileSize = LenB(fileData) Dim chunkSize As Long 'chunkSize = 320 * 1024 chunkSize = 30 * 1024 Dim startIndex As Long startIndex = 0 Dim endIndex As Long Dim numChunks As Long numChunks = RoundUp(fileSize / chunkSize) Dim xmlhttp As Object Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP.6.0") Dim chunk As String Dim i As Long For i = 1 To numChunks endIndex = startIndex + chunkSize - 1 If endIndex > fileSize - 1 Then endIndex = fileSize - 1 chunk = MidB(fileData, startIndex + 1, endIndex - startIndex + 1) Dim rangeHeader As String rangeHeader = "bytes " & startIndex & "-" & endIndex & "/" & fileSize '----------------------------------------------------------- 'uploadUrl provided as input is this: 'uploadUrl = "https://graph.microsoft.com/v1.0/me/messages/" & messageId & "/attachments/" & fileName & "/createUploadSession" '----------------------------------------------------------- xmlhttp.Open "PUT", uploadUrl, False xmlhttp.setRequestHeader "Content-Range", rangeHeader xmlhttp.setRequestHeader "Content-Type", "application/octet-stream" xmlhttp.send chunk If xmlhttp.Status <> 200 And xmlhttp.Status <> 201 And xmlhttp.Status <> 202 Then MsgBox xmlhttp.Status MsgBox "Error uploading chunk: " & xmlhttp.responseText, vbCritical Exit Sub End If startIndex = endIndex + 1 Next i End SubAccess_JimJul 28, 2024Copper Contributor264Views0likes0CommentsLink a table from MS Fabric
Is it possible to link a table stored in MS Fabric Dataflow Gen2 to an Access database? The data set is roughly 500k rows of data. FYI I'm not trying to link Fabric FROM an Access database. Rather I would like to work with the data in MS Access. Any help would be appreciated.JBartMadisonJul 07, 2024Copper Contributor280Views0likes0CommentsVBA code copies an Excel template into a specific workbook which is in the cloud - hangs randomly
My client has a small application which effectively, using Access VBA, copies an Excel template to a systematically named excel file, populates it, and then saves the destination excel workbook file. It hangs "randomly" , claiming it cannot find the renamed destination file, at copying time - one filesys copyfile statement - before it has been populated. The Access is running on 1 PC in a lan but the excel files are stored in the cloud - OneDrive. I think that the short process is too fast - sometimes - for the cloud to find / create the destination excel file. I also discovered that a newly arrived Excel advice banner was a problem. I "upgraded" the original Excel template as advised and this issue disappeared. But the "can't find" issue is not new. Any similar experiences?MDL999Jun 06, 2024Copper Contributor241Views0likes0Comments
Resources
Tags
- access1,625 Topics
- office 365355 Topics
- 2016195 Topics
- developer185 Topics
- Access Web Database100 Topics
- Access Web App57 Topics
- sharepoint51 Topics
- 201351 Topics
- 201042 Topics
- admin41 Topics