ms-access-2013

Supporting multiple versions of Excel for automation from an Access application

穿精又带淫゛_ 提交于 2019-12-24 02:22:51
问题 I have an Access app, developed in Access 2013 in multi-user env, uses Excel automation to export and format an Excel file. The normal Office/Excel 2013 (15.0) references have been made and all works well on Office 2013 machines. Does not play nicely on 2010 machines. Using a 2010 machine, I replaced the 15.0 references with 14.0 references, and the app is happy on 2010 and 2013 machines. Upon next edit/update on my 2013 machine the 15.0 references return. Any suggestions to more conveniently

Microsoft Access - Show name of logged in user from UserID

瘦欲@ 提交于 2019-12-23 05:45:16
问题 I have an Access database I'm working on which has a simple login system consisting of a drop down (combo) menu to select the username, a password field and a users table. Inside the users table, I'm storing the username, password and the first name of all the users. I've managed to get my login form working, but I'd like the user's first name to be displayed in a text box on the next form. I've managed to get the user's ID number, and display it in a text box, but I haven't been able to get

Syntax error in INSERT INTO statement. (VB and ACCESS 2013)

ε祈祈猫儿з 提交于 2019-12-23 04:47:38
问题 Forgive me for asking this stupid question but... I really cannot figure out how to solve this syntax error In my database(which is access 2013) I have this fields in my table Fields - Data Types NO - Number RANK - Short Text LAST NAME - Short Text FIRST NAME - Short Text MIDDLE NAME - Short Text ADDRESS - Short Text CONTACT NUMBER - Short Text ACCNT CODE - Short Text UNIT CODE - Number ATM ACCNT NUMBER - Number PENSION TYPE - Short Text REMARKS - Short Text Here is my code: Imports System

How could I use VBA to change a button's picture to one of the embedded default images?

℡╲_俬逩灬. 提交于 2019-12-23 04:45:43
问题 I'm trying to get a button to change from the "Arrow Left" to "Arrow Right" picture when I click it, but I'm not sure how to assign the images through VBA. I tried Me!btnCollapseUnscheduled.Picture = "Arrow Left" , but I get an error message this way. 回答1: In Access 2010 or later, you can store images in the MSysResources system table. Then choose Shared for your command button's Picture Type property, and select one of those shared images. Afterward, it's easy to toggle between the shared

VBA calculate MD5 hash on file contents

爷,独闯天下 提交于 2019-12-22 11:31:29
问题 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

Create a new lookup table where data already exists

痞子三分冷 提交于 2019-12-22 01:29:08
问题 I am working on a database in MS Access 2013 which has a considerable amount of non-normalised data, and I want to move them out to alternate tables and use them as lookups in the main table. However, when I create a lookup column, MS Access deletes the data and there is far too much data to reset every record by hand. Is there a way in Access 2013 to create such a lookup without losing the data? Please don't comment about how using lookup tables in Access is bad. I have read posts like the

Get contents of laccdb file through VBA

会有一股神秘感。 提交于 2019-12-21 04:50:46
问题 I want to be able to view the contents of my access database's laccdb file through VBA so I can use it to alert users (through a button) who else is in the database. I specifically don't want to use a 3rd Party tool . I have tried using: Set ts = fso.OpenTextFile(strFile, ForReading) strContents = ts.ReadAll This works fine if only 1 user is in the database. But for multiple users it gets confused by the presumably non-ASCII characters and goes into this kind of thing after one entry: Does

MS Access VBA SQL query debugging select case

半城伤御伤魂 提交于 2019-12-20 07:40:03
问题 In MS Access 2013 VBA I get a syntax error in this SQL-string: strSQL = "INSERT INTO [man_year] ( man_year_val, year_int, main_research_area, organisation, man_year_source ) SELECT KU.[2007], '2007' AS Expr1, " _ & "select case right(left(KU.man_year_source;6);2) like 'Hu' 3 case right(left(KU.man_year_source;6);2) like 'Sa' 1 case right(left(KU.man_year_source;6);2) like 'Te' 2 case right(left(KU.man_year_source;6);2) like 'Su' 4 case right(left(KU.man_year_source;6);2) like 'Ud' 5 AS Expr2,

Create sequential ID value based on the year that a record is added

不羁岁月 提交于 2019-12-17 06:57:26
问题 I am working on an Access 2013 database that will have different utility poles entered into the database and linked with other attributes. Each pole will have a unique global ID, and to simplify working I would like to add another unique ID that is more simple. I would like this field auto populated when a new pole in imported into the database. The ID would go as follows: SAC(year)-(Escalating number, cannot be a duplicate) ex. SAC16-20 (This would be the 20th pole entered into the database

Storing an image into an Attachment field in an Access database

时光毁灭记忆、已成空白 提交于 2019-12-17 04:07:28
问题 I'm writing a VB application where I need to store an image in the database. The user selects the image on their computer, which gives me the path as a string. Here's my attempt at it, however I'm getting the error "An INSERT INTO query cannot contain a multi-valued field." Here is my code: Dim buff As Byte() = Nothing Public Function ReadByteArrayFromFile(ByVal fileName As String) As Byte() Dim fs As New FileStream(fileName, FileMode.Open, FileAccess.Read) Dim br As New BinaryReader(fs) Dim