access-vba

How to maintain uniqueness during SQL Join within Access-VBA function?

北战南征 提交于 2020-01-07 02:18:32
问题 I currently have the following Access VBA function: Private Function MapFields(tableNameTemp As String, tableName As String, commonField As String, newTableName) sqlJoinQuery = "SELECT [" + tableNameTemp + "].[Field1], " & _ "[" + tableNameTemp + "].[Field2], " & _ "[" + tableNameTemp + "].[Field3], " & _ "[" + tableNameTemp + "].[Field4], " & _ "[" + tableName + "].*" & _ " INTO " + newTableName & _ " FROM [" + tableNameTemp & _ "] INNER JOIN [" + tableName & _ "] ON [" + tableNameTemp + "].

Array prepared within a VBA event. How to extract its contents from inside a different event?

浪尽此生 提交于 2020-01-07 02:16:08
问题 This question should apply to any VBA situ with events: I've filled an array within a Form_Load() event in MS Access. Now I would like to extract, dereference, the contents of that array from within a ListBox_DblClick() event. I Dim'd the array at the top of the form module (if it was Excel, it would be a sheet module) they both share; no luck in having the ListBox_DblClick event recognize that there is an array anywhere. Thanks for any help: Dim ArrWhatever() As String Function ThisArr

How to pass reference to combobox?

瘦欲@ 提交于 2020-01-07 02:06:22
问题 This is a continuation from a previous post of mine: How to select a printer for entire job?, where I basically want to print a series of reports from a form in my Access database. Which refers to this help doc: https://msdn.microsoft.com/en-us/library/ee336132(v=office.12).aspx I'm trying to create the combobox with active printers in it in order to temporarily change the default printer for a series of documents. I'm tripped up on where it says "pass a reference to a ComboBox control"...

Locked out of access database

天涯浪子 提交于 2020-01-07 01:36:06
问题 I created a database and disabled the 'shift' bypass. I also have an AutoExec module that is running on a constant loop and quits the application. Is there anyway to counter this or change the vba code? 回答1: Just press Ctrl + Break - This should let you in to the background code by breaking the code and debugging Hope this helps 回答2: You can also use vba to edit the properties from outside opendatabase("yourdbfullname").properties!Allowbypasskey = true 来源: https://stackoverflow.com/questions

Calling Javascript function from access VBA

喜欢而已 提交于 2020-01-06 19:56:31
问题 in access vba I'm able to retrieve an href tag from a website, however I found out that the href value triggers a javascript function rather than a link. The javascript function directs the user to a link that I want. My question is: how do I trigger that javacript function via VBA? Set ie1 = New InternetExplorer ie1.Navigate b.href 'Error here 'wait for website to load Do: Loop While ie1.Busy Or ie1.ReadyState <> 4 Set blist = HTML.getElementsByTagName("td") For Each c In blist address = c

Small Large Formula Convert to Acess VBA Calculated Field Query

感情迁移 提交于 2020-01-06 14:40:58
问题 I am trying to convert the following excel formula to a Calculated Field in Access. Using Expressions or combination of a user defined expression with VBA code. any help appreciated! And appreciate any thoughts about data normalization, however this is not the issue. Thx IF(SMALL(T319:V319,2)>6,SMALL(T319:V319,1),IF(SMALL(T319:V319,2)=0,LARGE(T319:V319,1),SMALL(T319:V319,2) Cells T319 - V319 are fields in each record generated by a data query generated. call them A,B,C for this purpose. 回答1:

Small Large Formula Convert to Acess VBA Calculated Field Query

此生再无相见时 提交于 2020-01-06 14:40:56
问题 I am trying to convert the following excel formula to a Calculated Field in Access. Using Expressions or combination of a user defined expression with VBA code. any help appreciated! And appreciate any thoughts about data normalization, however this is not the issue. Thx IF(SMALL(T319:V319,2)>6,SMALL(T319:V319,1),IF(SMALL(T319:V319,2)=0,LARGE(T319:V319,1),SMALL(T319:V319,2) Cells T319 - V319 are fields in each record generated by a data query generated. call them A,B,C for this purpose. 回答1:

Save attachment to hard drive

…衆ロ難τιáo~ 提交于 2020-01-06 08:22:23
问题 I am trying to code a simple task: retrieving an attachment from Access (2013) database and saving it to disk. At the moment I would like the code to get a first record from recordset and save the attachment to C:\maptest.pdf It shows error 3265: Item not found in this collection (yet every record in the database has an attachment). Does anyone have an idea what I am doing wrong? Private Sub CommandButton4_Click() Dim appAcc As New Access.Application Dim rst As DAO.Recordset2 Dim rsA As DAO

Rotate selected images in a folder using VBA and ImageMagick

China☆狼群 提交于 2020-01-06 08:22:21
问题 I want to check a folder if a rotated version of my images exists, if it doesn't I want to use ImageMagick to automatically do it for me (or another program if it would be a better option). This is my code: Dim imageDomain As String Dim imagePath As String Dim rotatePath As String Dim rotateBool As Boolean Dim imageRotator As Integer Dim rs As DAO.Recordset Set rs = CurrentDb.OpenRecordset("SELECT Afbeelding FROM Products") imageDomain = CurrentProject.Path & "\folder\" If Not (rs.EOF And rs

Reset counter ID to 1 for every new year in MS Access

﹥>﹥吖頭↗ 提交于 2020-01-06 08:03:47
问题 I have two tables , tblContacts and tblTrackJob . Every time a new record is about to be added in tblContacts , id like to assign its JobNo field to the value of whatever ID is in tblTrackJob has stored. Id like the value to reset to 1 every year. For example... first name, last name, JobNo, dateEntered bob smith 01 1/1/2013 john doe 02 1/2/2013 mary Thomas 03 1/3/2013 Joe Henry 01 1/1/2014 回答1: Since we're dealing with Access 2010 we can create a Before Change data macro for the [tblContacts