ms-access

Disabling multi-line fields in MS Access

我的梦境 提交于 2020-01-03 20:22:07
问题 Is there a way to disable entering multi-line entries in a Text Box (i.e., I'd like to stop my users from doing ctrl-enter to get a newline)? 回答1: I was able to do it on using KeyPress event. Here's the code example: Private Sub SingleLineTextBox_ KeyPress(ByRef KeyAscii As Integer) If KeyAscii = 10 _ or KeyAscii = 13 Then '10 -> Ctrl-Enter. AKA ^J or ctrl-j '13 -> Enter. AKA ^M or ctrl-m KeyAscii = 0 'clear the the KeyPress End If End Sub 回答2: The way I did it before (and the last time I

MS-Access 2003 SQL modification for resetting sum values based on a date

偶尔善良 提交于 2020-01-03 20:03:02
问题 I have a query that is pulling data perfectly with one exception, I want the data sums to start over at an anniversary date. My current query is; "qry_Vac2" UserID Category Gain Used Left the querys SQL; SELECT SchedulingLog.UserID, SchedulingLog.Category, Sum(IIf([CatDetail] Like 'Ann*',[Value],0)) AS Gain, Sum(IIf([CatDetail] Like '*Used*',[Value],0))+Sum(IIf([CatDetail] Like 'Adj*',[Value],0)) AS Used, [Gain]+[Used] AS [Left] FROM SchedulingLog GROUP BY SchedulingLog.UserID, SchedulingLog

MS-Access 2003 SQL modification for resetting sum values based on a date

佐手、 提交于 2020-01-03 20:01:37
问题 I have a query that is pulling data perfectly with one exception, I want the data sums to start over at an anniversary date. My current query is; "qry_Vac2" UserID Category Gain Used Left the querys SQL; SELECT SchedulingLog.UserID, SchedulingLog.Category, Sum(IIf([CatDetail] Like 'Ann*',[Value],0)) AS Gain, Sum(IIf([CatDetail] Like '*Used*',[Value],0))+Sum(IIf([CatDetail] Like 'Adj*',[Value],0)) AS Used, [Gain]+[Used] AS [Left] FROM SchedulingLog GROUP BY SchedulingLog.UserID, SchedulingLog

Error when SQL-querying flatfiles with custom file-extension

大兔子大兔子 提交于 2020-01-03 19:05:57
问题 I'm looking for a way to query flatfiles with custom file-extensions directly via SQL. Normally use something like SELECT * FROM [Text;DATABASE=C:\Flatfiles].[S7121070_ppis#csv] which works terrific with .txt, .csv and .tab. However, in my current project I work with fixed-width flatfiles with an .ftp7-extension. When querying those files in with VBA, I encounter Err# -2147217911, stating that the object or database is locked. Oddly, this occurs only whenever I querying anything that's not a

MS Access - open a form taking a field value from a previous form

三世轮回 提交于 2020-01-03 17:43:07
问题 I have a form in an MS Access database which lists all the landowners consulted with for a new electricity line. At the end of each row is a button which opens another form, showing the details of all consultation, offers made etc. I am trying to use vb in MS Access to take the contactID and automatically put it in a field in the details form, so that landowner's consultation details will pop up automatically. I am not a vb programmer at all (I have a comp sci degree mostly in Java and I'm

Importing data from Access to SQL Server (with minor table changes)

对着背影说爱祢 提交于 2020-01-03 17:19:25
问题 I'm currently working on migrating an application from MS-Access to MS SQL Server. In the process, there are a few minor changes that I am making to the table layouts (I am splitting a few things up into more two tables), however, I would still like to keep all the data that is present in the database. What would be the best way to import the data, while changing the database structure to suit my new requirements? 回答1: If you are planning to upgrade a Microsoft Access database to SQL Server

MS Access Rounding Precision With Group By

两盒软妹~` 提交于 2020-01-03 15:56:15
问题 Why doesn't the average of the score of an employee of each month, when summed, equal the average of the employees score (ever)? Average SELECT Avg(r.score) AS rawScore FROM (ET INNER JOIN Employee AS e ON ET.employeeId = e.id) INNER JOIN (Employee AS a INNER JOIN Review AS r ON a.id = r.employeeId) ON ET.id = r.ETId WHERE (((e.id)=@employeeId)) Returns 80.737 Average By Month SELECT Avg(r.score) AS rawScore, Format(submitDate, 'mmm yy') AS MonthText, month(r.submitDate) as mm, year

Use OLEDB to read AccessFile from Stream to DataSet

☆樱花仙子☆ 提交于 2020-01-03 15:16:30
问题 I Use Oledb to read an AccessFile(.accdb) to DataSet, I don't know about table names or columns, The regular implementation is: public void GetAccessDB(string filepath){ this.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source = " + filepath; // get Table Names this.TableNames = new List<string>(); using (System.Data.OleDb.OleDbConnection oledbConnection = new System.Data.OleDb.OleDbConnection(this.ConnectionString)) { oledbConnection.Open(); System.Data.DataTable dt = null; dt

SQL query to select all columns in a table except two columns

Deadly 提交于 2020-01-03 13:37:00
问题 I have a table in ms-access with column names A to H TableA A B C D E F G H how can i write a query to select all columns except B and F columns. Query result should be A C D E G H Do we have something like this select * from TableA except B, F ? 回答1: Nope, you're stuck with select a, c, d, e, g, h from TableA 回答2: No, we don't. You have to use SELECT A, C, D, E, G, H FROM TableA And this is good if you ask me. SELECT * is evil enough. 回答3: select A, C, D, E, G, H from TableA 回答4: I don't

double inner join in access db

混江龙づ霸主 提交于 2020-01-03 13:30:14
问题 I need to get some data from two tables, 1 people, 2 tasks, The following query in SQL works, and Access does not work SELECT Task_Id, e2.emploeey_name AS W_FROM, e1.emploeey_name AS W_TO, t.Task_Details FROM tasks AS T INNER JOIN Employees AS e1 ON e1.Emploeey_id = T.Task_To INNER JOIN Employees AS e2 ON e2.Emploeey_id = T.write_From I tried many ways, and I searched in Google and I did not find an answer If anyone has a solution I would appreciate it very 回答1: Have you tried it with