ms-access-2010

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

How do i create a query that will give me a cumulative total?

末鹿安然 提交于 2019-12-24 10:23:08
问题 I have a table with the following columns: reportDate DATETIME and losses CURRENCY and of course the ID column. How do I write a query that will return a table with a running total of the losses column? Each date will have multiple entries so i think they will need use Sum() for each date. I know this has to do with the DSum function but im still lost on this one. It should look something like Month Losses Cum ----- ------ ----- Jan $3,000 $3,000 Feb $2,000 $5,000 Mar $1,500 $6,500 Having a

Audit Track a form

 ̄綄美尐妖づ 提交于 2019-12-24 08:56:05
问题 I am setting up a Audit Tracking system for the forms in my database. I am following the example from Susan Harkins Here My code works for my form customers which is based off the customers table. Here is my code: Const cDQ As String = """" Sub AuditTrail(frm As Form, recordid As Control) 'Track changes to data. 'recordid identifies the pk field's corresponding 'control in frm, in order to id record. Dim ctl As Control Dim varBefore As Variant Dim varAfter As Variant Dim strControlName As

Set up a form control that updates when a value in a combo box is selected

别说谁变了你拦得住时间么 提交于 2019-12-24 08:29:21
问题 I have a combo box on an Order Entry Form I designed that allows me to select from a dropdown of Company Names from a table entitled tblCustomers. The row source for this control is: SELECT CustomerID, CompanyName FROM tblCustomers; The bound column is 1 so that I can store the CustomerID in the underlying tblOrders table. My question is: I would like a text box on the form that displays the SalesPerson (which is also in the tblCustomers table) associated with the Customer chosen in the combo

Distinct Row - Based on two fields

匆匆过客 提交于 2019-12-24 06:58:26
问题 Is there a way to have a table definition that bases its Non-Duplication on two fields? By this i have 3 columns gid, cid, price Criteria: There can only be 1 cid for 1 gid There can be multiple cid 's as long as there are multiple gid 's and criteria 1 is not violated I basically want to have the restriction in the Table Design, if possible. Not sure if its possible just figured i would ask. Edit (2010-08-27 11:18am CST) Ok a little clarification, i have two indexes as well, one on gid and

System Resources Exceeded whilst performing UPDATE SQL in Access inside Transaction

心已入冬 提交于 2019-12-24 05:00:11
问题 I'm performing a simple UPDATE tblTable SET DataSet=3 inside a transaction, but a few seconds after trying to run it, I get a 3035 - System Resources exceeded. There are ~30K rows. Dim db As DAO.Database, wrk As DAO.Workspace, errCount As Long, stSQL As String Set db = CurrentDb Set wrk = DBEngine.Workspaces(0) errCount = 0 wrk.BeginTrans Debug.Print "There are no existing entries in the selected DataSet, preparing to proceed..." ' - -- --- stSQL = "UPDATE tblImportCleaned SET DataSetID=" &

Inserting date into string

可紊 提交于 2019-12-24 03:44:34
问题 In VBA, I am setting a field in a form equal to a string like so: tmpNum=1 me.field="DD" & Format(DATE, "mmddyy") & tmpNum For today I would want me.field to be DD0428151 but instead the whole Format(DATE, "mmddyy") statement seemingly does nothing and I get DD1 in the form. Does anyone understand why the date isn't appearing in my string and how to fix it? 回答1: Strange things like this can happen if you have a field named Date in your table and/or a control named Date on your form. They will

Alter Table doesn't work under MS Access 64 bit. Why?

不问归期 提交于 2019-12-24 03:27:58
问题 I am trying to write a simple function to resize a text field in MS Access 64 bit version under Windows 7. It fails with the error 3420, object invalid or no longer set. Why is this? Can't you alter a table in code anymore under MS Access 64bit version? Here is the code: Private Function ResizeSingleTextField(sTableName As String, _ sFieldName As String, _ iLength As Integer) ResizeSingleTextField = False Dim sSQL As String sSQL = "ALTER TABLE " & sTableName & " " _ & "ALTER COLUMN " &

Access 2010 Limit Query Results

我的梦境 提交于 2019-12-24 03:24:17
问题 What's the syntax in MS Access 2010 for limiting the results of a query to the first 1,000? I've tried this SELECT tblGL.[Cost Centre Code] FROM tblGL LIMIT 1000; but I get the error 'Syntax error in FROM clause'. I've also tried setting the Max Records property but it doesn't seem to do anything - I still get 7,000+ results regardless of what value I enter into the Max Records field. I also want to have a 2nd query which selects the next 25,000, starting from the 1,001st. Something like:

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