ms-access-2013

Delete 5 Records but RecordsAffected Property is 0

老子叫甜甜 提交于 2020-01-14 14:17:08
问题 Here is a code snippet: Private Sub frmSearch_UnMarkAll() Const sqlD As String = "DELETE * FROM PickList WHERE TableName = ""CARS"" AND KeyNo IN (" & _ "SELECT RecNo FROM Cars " If frmSearch.WhereSql <> vbNullString Then CurrentDb.Execute sqlD & frmSearch.WhereSql & ")" End If Stop End Sub This function is called by clicking a command button on the frmSearch form. The button raises an event that is handled by the above code. WhereSql is the where clause from the listbox displayed on the find

Delete 5 Records but RecordsAffected Property is 0

99封情书 提交于 2020-01-14 14:14:57
问题 Here is a code snippet: Private Sub frmSearch_UnMarkAll() Const sqlD As String = "DELETE * FROM PickList WHERE TableName = ""CARS"" AND KeyNo IN (" & _ "SELECT RecNo FROM Cars " If frmSearch.WhereSql <> vbNullString Then CurrentDb.Execute sqlD & frmSearch.WhereSql & ")" End If Stop End Sub This function is called by clicking a command button on the frmSearch form. The button raises an event that is handled by the above code. WhereSql is the where clause from the listbox displayed on the find

Q: How to ROUNDUP a number in Access 2013?

送分小仙女□ 提交于 2020-01-14 03:07:26
问题 For Access 2013, I need a way to round up any fractional numbers to the next whole number in an SQL query. Example: SELECT ROUNDUP(NumberValues) FROM Table1 In the above query, a row with 1.25 should return as 2 after querying. As far as I know, there's no ROUNDUP function in Access 2013 for use in a SQL query statement. 回答1: I found a ROUNDUP equivalent from this link: http://allenbrowne.com/round.html#RoundUp To round upwards towards the next highest number, take advantage of the way Int()

Recordset is not updatable (query from two tables)

喜夏-厌秋 提交于 2020-01-07 05:04:06
问题 I am using Microsoft Access 2013 with Sharepoint lists and I have two tables: students : ID, Full name, Mobile, Start_Date (the date that they start studying at my centre), and some irrelevant fields => there are many students with different starting dates [Weeks Off] : ID, Reason, From_Date (the date that the centre is temporarily closed), [Number of Weeks] (the number of weeks that the centre is temporariliy closed from that From_Date) => in each student' study time, they may have some

Reducing Access database size

夙愿已清 提交于 2020-01-07 03:26:14
问题 I have an Access database, and it is 14 Mb! I really want to reduce the size as I takes a minute to download from the server. I've embedded images as backgrounds on the forms. However, converting the JPG to PNG or GIF doesn't seem to reduce the file size at all. Compacting also doesn't do much. Please advise if anyone knows how to reduce the file size significantly Thanks!! 回答1: The answer is simple: Move the pictures off the database to separate files. That said, 14 MB isn't really that much

Make Fileds compulsory if a particular filed is filled in Access Form

巧了我就是萌 提交于 2020-01-07 03:24:14
问题 I have a form in access, where I want to make 3 fields ( FYear , cboPeriodicity , cboPeriod ) compulsory if another field cboCompliance is filled in by user. I have tried the below code, where I am canceling save, if any of these fields are Empty. And also giving error message through msgBox Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo Form_BeforeUpdate_Err 'Audit Data Values Set Me.LastModifiedBy.Value = [TempVars]![currentUserID] Me.LastModifiedTime.Value = Now() 'If

Import entire folder of Excel files into Access 2013

吃可爱长大的小学妹 提交于 2020-01-07 01:48:40
问题 I am having a super hard time trying to import multiple Excel files into a specific Access 2013 table. I tried using the code I found from another SO question: Do While Len(strFile) > 0 DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, _ strTable, strPathFile, blnHasFieldNames Loop but this makes new tables for each file, and I need all 101 files to be in a single table. The code I try to test it fails on DoCmd.TransferSpreadsheet, and I can't seem to get that part to work at all.

Work around Ms Access continuous form?

只愿长相守 提交于 2020-01-06 10:42:07
问题 The problem In the following form i want to accomplish two things When Post check box is ticked i.e. when post= true a query should run targeting the current record only and subtracting the amount with balance field in the customer table. UPDATE Customer INNER JOIN [Loan Payment] ON Customer.CUSID = [Loan Payment].CUSID SET Customer.CUSBalance = [Customer]![CUSBalance]-[Forms]![Loan Payment]![Amount] WHERE (((Customer.CUSID)=[Forms]![Loan Payment]![CUSID])); BUT INSTEAD THE WHEN THE QUERY IS

How to Create a new blank Record without it showing the previous data from the previous record?

纵然是瞬间 提交于 2020-01-06 01:34:12
问题 I keep trying to create a new record expecting a new blank form to show up but all of the info from the previous form shows up. I need a blank form to enter data but i also need to save all of my previous forms. Overall, I want to keep adding onto my records. But somehow it won't let me. 回答1: If I'm understanding correctly you open a form but it is showing the data you previously entered? if it is that you want avoid seeing the previous data and just have a blank for for entry that you should

Dynamically Populate VBA Array

若如初见. 提交于 2020-01-05 05:31:28
问题 In the example syntax below, how can I add each element to a new array instead of printing? I am unsure how to do such as I would not know the size of the array, since it could be 0 (no need to ever initialize the array) or it could be the Ubound of the array it is iterating. Option Compare Database Option Explicit Function TestIt() Dim animalarray As Variant, xyz As Variant animalarray = Array("Cat", "Cow", "Camel", "Dire Wolf", "Dog", "Coyote", "Rabbit", "Road runner", "Cougar") For Each