VBA
16 TopicsInconsistent Results Referencing Nested Subreport Property
I have placed several subreports in an unbound report's Report Header. Each subreport has two subreports. I'm trying to get the value of the Top property of the first of these sub-subreports, but I'm getting inconsistent results. The reference I'm (currently) using in the OnLoad event of the main report is: intSubSubTop = Me.Controls(strSub1).Report.Controls(strSubSub1).Top This works perfectly when I switch from Design View to Print View, but I get a runtime error (2455: the expression "has an invalid reference to the property Form/Report") when I open the report from the navigation pane. What's the difference between these two actions? I've tried different variations to no avail. What do I need to do to make it work consistently? I'm using Access 2010 on Windows 10 Pro527Views0likes5CommentsVBA: DoCmd.RunCommand acCmdCopy not working
I have a Rich Text Formatted Access field on a subform that I need to copy to the clipboard. Because Writeline doesn't have a FormattedText option, I can't simply write the field to the clipboard. Doing that copies it with the code and unformatted text. So instead, I'm trying to use DoCmd.RunCommand acCmdCopy Here's the code: 'set focus on subform Me![Case Attachments subform].SetFocus 'go to the last record on the subform DoCmd.GoToRecord , , acLast 'Copy the Field value DoCmd.RunCommand acCmdCopy The copy isn't working. The clipboard is empty. Interestingly, when I add a debug test right before the acCmdCopy: Dim tryit As String tryit = Me![Case Attachments subform].Form![Doc Description].Text MsgBox (tryit) it shows me that tryit equals the text I need to copy. I.e., I have the right field selected in its entirety. Anyone have any suggestions on how to get it to work or alternatives to copy the rich text to the clipboard so it can be paste correctly. (And, before you offer, NO, I don't want to write VBA code to jump over to Word, create a new file, paste it there, copy it, and delete the Word file).3.2KViews0likes5CommentsAccess Europe Meeting - Wed 7 Feb
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE add-in MZ-Tools, Carlos Quintero, will be leading a presentation called Top 10 advanced features of MZ-Tools For more details about the topic and speaker together with connection details for the meeting, please visit https://isladogs.co.uk/aeu-24/ or https://accessusergroups.org/europe/event/access-europe-2024-02-07/ During the session, a free copy of MZ-Tools will be given away to one person attending the session. Be there (or be square...)! For local times, please check https://www.worldtimebuddy.com/ The meeting will again be held on Zoom. When the time comes, you can connect using Join Zoom Meeting. If you are asked, use: Meeting ID: 924 3129 5683 ; Passcode: 661210546Views0likes2CommentsAccess 2019 - List Box.Requery event on Main Form causes Sub Form Current event to trigger
I have a simple Main Form with one SubForm. On the Main Form I have a ListBox called "listItems" whose RowSource is set to a Query. If I issue a listItems.Requery, the Current event of the SubForm is triggered. Why is this happening? And is it possible to prevent the SubForm current event from triggering?3.5KViews0likes11CommentsConnecting MS Access to MS Outlook Calendar - MS Outlook calendar to automatically generate event
In short, I am building a holiday planner, which all the employees within my department are to use. I want to build such functionality in MS Access that, whenever I have approved a holiday, i.e. the approved time period goes into table X, Columns Y and Z, which columns are date columns. I want to extract the time period columns Y and Z form and automatically generate an event in the MS Outlook calendar, which states the employee name from the employee table and the time period they are to be absent. For this I need MS Outlook to extract the data from MS Access. Do you guys have a suggestion how this may happen? P.s. Also I want the calendar I made in MS Outlook to check the table once every 24h and for every new row in table X I want it to create a new event automatically and delete the relevent event if the row is delete1.3KViews0likes1CommentAppcrash Access / VBA
Hi, I am part of a development team that has an application written in access / vba (access runtime 2000) in production and without installing any updates on some machines, with the Windows 10/11 operating system, the program no longer starts. Searching the internet, we found this article: https://learn.microsoft.com/en-gb/DeployOffice/security/internet-macros-blocked#use-policies-to-manage-how-office-handles-macros Could the problem be related to this update? We tried following the guidelines to get it back up and running but couldn't fix it. Has anyone faced and solved any similar problem? Thanks for any help. --- Salve, faccio parte di un team di sviluppo che ha in produzione un'applicazione scritta in access / vba (access runtime 2000) e senza l'installazione di nessun aggiornamento su alcune macchine, con sistema operativo Windows 10/11, il programma non parte più. Eseguendo delle ricerche su internet abbiamo trovato questo articolo: https://learn.microsoft.com/en-gb/DeployOffice/security/internet-macros-blocked#use-policies-to-manage-how-office-handles-macros Il problema potrebbe essere collegato a questo aggiornamento? Abbiamo provato ad seguire le linee guida per ripristinare il funzionamento ma non siamo riusciti a risolvere. Qualcuno ha affrontato e risolto qualche problema simile? Grazie per un eventuale aiuto.2.8KViews0likes13CommentsVBA Modules Access no longer available
Hi everyone, I have (maybe: i had) a file access with more VBA modules inside. The file is stored into a OneDrive's location. After a couple of moths I've opening the files to continue the programming activities and I've got a surprice. All modules are not longer available. I see it in the panel but whe I try to open it I've a message: The module name is wrong or it refers to a nonexistant module. I contacted Microsoft support and I discovered a huge truth: There was never support for Microsoft Access. Is there someone that had same problem and fixed it ?2.7KViews0likes5CommentsSharepoint list update is not working sometimes
Hello all, I have a sharepint list, and updating the list using access vba. I have a problem sometime the update works and sometimes it doesnot works, i have been trying to solve this problem using different commands like CurrentDb.TableDefs("shp_table").RefreshLink but unfortunately its not working. I am using a loop with maybe 5 recordsets, sometime 4 gets updated, sometimes 5 my update command is right. Do you have some possible solution for this? many thanks in Advance BR ArslanSolved7.8KViews0likes31CommentsRating system problem
To start out with, this form is used to rate things using a five-star method. I have a combo box that a user can select a category on which they wish to rate the transaction on. Once they select one and decide to add it, I have VBA that adds that selected category to the database and requeries a subform. The subform is linked to the overall record. The entry is listed in the subform and has 5 empty stars and the user can click on the star and it, as well as the previous stars, get replaced with a filled star. The images are merely placeholders and the actual rating, 1 to 5, is stored as an integer. Everything works to this point. My issue is, when the user tries to select a star, all the ratings for all the other categories are also mirrored. I am sure it is something very simple I am overlooking but I just can't put my finger on the issue. As the 5 placeholders are individually named but duplicated for each record, my code does not know specifically which entry it should stick to. Can anyone help me on this; point me to a tutorial online or help anything to help rattle my brain My continuous form looks like : This is subform in the actual form with the Rating category combobox. The Overall Rating works like it should. Any help and guidance is greatly appriciated560Views0likes0CommentsUnbound Text box Value to strPathFile variant in Access using Visual basic.
I am in need of some help. I am trying to import an excel book, with different sheets into Access. The problem I am having is copying the link from the Textfilename to module1 so that it is somewhat automated. For the life of me, I can't figure it out. I think it is not really written to the text box is the problem, but not sure. Any help would be appreciated! Thanks Mike Public Sub Import_File(Filename As String, tablename As String) Dim blnHasFieldNames As Boolean, blnEXCEL As Boolean, blnReadOnly As Boolean Dim lngCount As Long Dim objExcel As Object, objWorkbook As Object Dim colWorksheets As Collection Dim Item As Variant Dim strPassword As String Dim strPathFile As Variant ' Establish an EXCEL application object On Error Resume Next Set objExcel = GetObject(, "Excel.Application") If Err.Number <> 0 Then Set objExcel = CreateObject("Excel.Application") blnEXCEL = True End If Err.Clear On Error GoTo 0 ' Change this next line to True if the first row in EXCEL worksheet ' has field names blnHasFieldNames = True ' Replace C:\Filename.xls with the actual path and filename strPathFile = File ' Replace passwordtext with the real password; ' if there is no password, replace it with vbNullString constant ' (e.g., strPassword = vbNullString ) strPassword = vbNullString blnReadOnly = True ' open EXCEL file in read-only mode ' Open the EXCEL file and read the worksheet names into a collection Set colWorksheets = New Collection Set objWorkbook = objExcel.Workbooks.Open(strPathFile, , blnReadOnly, , _ strPassword) For lngCount = 1 To objWorkbook.Worksheets.Count colWorksheets.Add objWorkbook.Worksheets(lngCount).Name Next lngCount ' Close the EXCEL file without saving the file, and clean up the EXCEL objects objWorkbook.Close False Set objWorkbook = Nothing If blnEXCEL = True Then objExcel.Quit Set objExcel = Nothing ' Import the data from each worksheet into a separate table For lngCount = colWorksheets.Count To 1 Step -1 DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _ "tbl" & colWorksheets(lngCount), strPathFile, blnHasFieldNames, _ colWorksheets(lngCount) & "$" Next lngCount ' Delete the collection Set colWorksheets = Nothing ' Uncomment out the next code step if you want to delete the ' EXCEL file after it's been imported ' Kill strPathFile End Sub Public Sub bntBrowse_Click() Dim diag As Office.FileDialog Dim Item As Variant Dim File As Variant Set diag = Application.FileDialog(msoFileDialogFilePicker) diag.AllowMultiSelect = False diag.Title = "Please select a excel spreadsheet" diag.Filters.Clear diag.Filters.Add "Excel Spreadsheets", "*.xls,*.xlsx" If diag.Show Then For Each Item In diag.SelectedItems Me.txtFileName = Item Next End If End Sub Public Sub bntImportSpreadsheet_Click() Dim FSO As New FileSystemObject Dim File As Variant If Nz(Me.txtFileName, "") = "" Then MsgBox "Please select a file!" Exit Sub End If If FSO.FileExists(Nz(Me.txtFileName, "")) Then Module1.Import_File Me.txtFileName, FSO.GetFileName(Me.txtFileName) Else MsgBox "File Not found" End If1KViews0likes2Comments