access-vba

Error 3251 on .oldValue control property

不羁的心 提交于 2020-01-15 01:47:02
问题 I am currently working on adding an audit trail to a MS-Access 2010 database and I am struggling with "error 3251 : operation is not supported for this type object" Here is the code of my audit trail module, mostly arranged code coming from web : Public Function auditChanges(RecordID As String, userAction As String, cForm As Form) Dim db As DAO.Database Dim rst As DAO.Recordset Dim ctl As Control Dim userLogin As String Set db = CurrentDb Set rst = db.OpenRecordset("SELECT * FROM T_AUDIT")

Operation must use an Updateable Query / SQL - VBA

时光怂恿深爱的人放手 提交于 2020-01-14 18:47:32
问题 I am trying to create a very dynamic macro that will update different tables in a Database, depending on what the user chooses. Each table has of course distinct titles and information. I'm having a problem with the update (when the user adds new records to an old Table). This is part of the code, the problem is when it gets to the ".update", I get the "Operation must use an Updateable Query" error. Dim DBCnn As ADODB.Connection Dim RecSet As ADODB.Recordset Dim sQRY As String Dim FilePath,

Invalid reference to Form property of subform (ms Access 2007)

送分小仙女□ 提交于 2020-01-14 14:25:28
问题 I'm using a technique similar to that in Remou's answer to this question to manipulate the propeties of the controls on a subform. Works great as long as the parent form's recordset has at least one record . If the parent form has no records, I get: Error 2455, "You entered an expression that has an invalid reference to the property Form/Report." The error is thrown when I attempt the recursive call. A simplified version of the code is below (I've stripped out error handling & a couple more

Getting listbox items to array using access VBA

谁说我不能喝 提交于 2020-01-13 16:24:06
问题 I have a listbox in access form. it contains 18 items . How do i store those itmes into array using access vba. 回答1: The following will pull the contents of a listbox into an array and spit back out the contents. Dim Size As Integer Size = Me.List0.ListCount - 1 ReDim ListBoxContents(0 To Size) As String Dim i As Integer For i = 0 To Size ListBoxContents(i) = Me.List0.ItemData(i) Next i For i = 0 To Size MsgBox ListBoxContents(i) Next i 来源: https://stackoverflow.com/questions/23278420/getting

Getting listbox items to array using access VBA

点点圈 提交于 2020-01-13 16:23:47
问题 I have a listbox in access form. it contains 18 items . How do i store those itmes into array using access vba. 回答1: The following will pull the contents of a listbox into an array and spit back out the contents. Dim Size As Integer Size = Me.List0.ListCount - 1 ReDim ListBoxContents(0 To Size) As String Dim i As Integer For i = 0 To Size ListBoxContents(i) = Me.List0.ItemData(i) Next i For i = 0 To Size MsgBox ListBoxContents(i) Next i 来源: https://stackoverflow.com/questions/23278420/getting

Getting listbox items to array using access VBA

試著忘記壹切 提交于 2020-01-13 16:22:08
问题 I have a listbox in access form. it contains 18 items . How do i store those itmes into array using access vba. 回答1: The following will pull the contents of a listbox into an array and spit back out the contents. Dim Size As Integer Size = Me.List0.ListCount - 1 ReDim ListBoxContents(0 To Size) As String Dim i As Integer For i = 0 To Size ListBoxContents(i) = Me.List0.ItemData(i) Next i For i = 0 To Size MsgBox ListBoxContents(i) Next i 来源: https://stackoverflow.com/questions/23278420/getting

List Box multiple value selection

≯℡__Kan透↙ 提交于 2020-01-12 11:42:29
问题 I have created form based on query output. I had used three comboboxes and one list box. First combobox gives me list of Dept, selection of Dept on second gives me location of that Dept (distinct), the third gives me (distinct) project from that location, then next is list box who displays the some codes of that project. The problem is I am able to select only one code from that list and get output in Excel. If I wanted to select two values at a time, how would I do that? If I select Multi

Access Database Security Question

旧城冷巷雨未停 提交于 2020-01-11 13:39:51
问题 I have a database in Access 2003 that I only want certain people to be able to access. In my database I have a table which lists the people that should be able to access the database. (Tbl_BIRT_Users). The table contains their name, ntlogin and email address. It also has an 'adminstrator' field. My question has two parts: 1 - On opening the database how can I get it to lookup the ntlogin (environ username) of the person and ensure that that person is authorised to use the database? 2 - I need

Event not Firing in MS Access VBA

本小妞迷上赌 提交于 2020-01-11 13:05:23
问题 I have a form in MS Access which has an image. The image has an Click event which opens a modal form. The modal form has an OK and Cancel button. When you click the OK button, an event is supposed to fire which tells the main form which button was clicked. (This is to simulate the DialogResult functionality in C#). However, the code in the event handler never runs. The modal form has the following in the general declarations: Public Event OnDialogBoxClose(NewRecordID As Long, DialogResult As

Event not Firing in MS Access VBA

谁说胖子不能爱 提交于 2020-01-11 13:05:08
问题 I have a form in MS Access which has an image. The image has an Click event which opens a modal form. The modal form has an OK and Cancel button. When you click the OK button, an event is supposed to fire which tells the main form which button was clicked. (This is to simulate the DialogResult functionality in C#). However, the code in the event handler never runs. The modal form has the following in the general declarations: Public Event OnDialogBoxClose(NewRecordID As Long, DialogResult As