ms-access-data-macro

Access 2016 Table Macros After Insert modify fields in newly created record

十年热恋 提交于 2020-01-06 04:53:10
问题 Using a custom form, fields are updated on a newly created record by an operator. When a new record is created there are fields within that newly created record that are to be updated based on values in another field. For example a field, CustID is updated based on the Primary Key, "PK" as follows: CustID="NW"&Format([PK],"000000") . I can perform this update using an update query however, I would like this update to happen automatically immediately following the creation of the new record. I

Access data macro get value from query (auto numbering)

社会主义新天地 提交于 2019-12-24 11:16:11
问题 Instead of the using the auto number in Access (sometimes produces duplicates) I've decided to generate my own numbers. I am using the data macro Before Change but I'm not sure on how to run the query SELECT MAX(ID)+1 FROM MyTable and insert it into the ID field on each Insert . I've messed around with the SetField, SetLocalVar, LookUpRecord actions but no luck so far. EDIT: I've tried using DMAX in the expression as per example: https://www.599cd.com/tips/access/incrementing-your-own-counter

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

Ms Access Data Macro Return Record Set

北慕城南 提交于 2019-12-13 07:37:01
问题 I am using a Data Macro for one of my Access table's after insert event. Inside this Data Macro, I am using SetLocalVar to call one of my functions written in vba to insert the same inserted record set into my SQL Database. This is how the Expression in SetLocalVar currently looks like; AfterInsertMacro("TblLotStatus",[LotStatusID], [NextStatus], [Status], [Printed], [Active], [AvailableForPull] ) Now, instead of returning back every column as a separate variable, can't I return a record set

Can I use Access VBA to determine if a table has a Data Macro?

馋奶兔 提交于 2019-12-08 11:24:35
Is there a way to determine via VBA if an Access table contains a data macro or not? I have data macros on most of my tables, but my code fails if it encounters a table without it. I don't receive an error message. Instead, the code keeps running as if it is in an infinite loop, but I have to force Access to quit to escape. Specifically, I'm trying to save all of my tables and the data macros so I can use the (undocumented) LoadFromText function to recreate them later. I've highlighted the problem in my code sample, below, with ** BUG **. For Each td In db.TableDefs If Left(td.Name, 4) <>

Can I use Access VBA to determine if a table has a Data Macro?

放肆的年华 提交于 2019-12-08 05:27:09
问题 Is there a way to determine via VBA if an Access table contains a data macro or not? I have data macros on most of my tables, but my code fails if it encounters a table without it. I don't receive an error message. Instead, the code keeps running as if it is in an infinite loop, but I have to force Access to quit to escape. Specifically, I'm trying to save all of my tables and the data macros so I can use the (undocumented) LoadFromText function to recreate them later. I've highlighted the

how to export Access 2010 data macros

喜欢而已 提交于 2019-11-27 23:11:26
I need to transfer Access data macros from my test db to my production db. Anybody know how to do that? I know that transferring tables from one accdb to another will also transfer the data macros, but that's not an option in my case. I also know I can recreate them manually in the production accdb, but that leaves me open to errors and requires taking the production database down for a longer time than would a scripted transfer scenario. If I only had to do this once it wouldn't be such a big deal, but I'll need to do it many times over the course of a development project. I've tried

Cannot edit or re-save an existing event-driven Data Macro in Access 2010

耗尽温柔 提交于 2019-11-26 23:41:59
问题 (This is a follow-up to an answer from an earlier question here.) I have an Access 2010 database file containing a table with a Before Change Data Macro: I can open the table in Datasheet View and add rows, and the Data Macro behaves as expected. However, if I open the table in Design View, open the Data Macro for editing, do something trivial like click the [+] beside one of the macro steps to expand the details, and then try to save the "changes" I get the error The 'LookUpRecord' macro

how to export Access 2010 data macros

扶醉桌前 提交于 2019-11-26 21:20:59
问题 I need to transfer Access data macros from my test db to my production db. Anybody know how to do that? I know that transferring tables from one accdb to another will also transfer the data macros, but that's not an option in my case. I also know I can recreate them manually in the production accdb, but that leaves me open to errors and requires taking the production database down for a longer time than would a scripted transfer scenario. If I only had to do this once it wouldn't be such a