ms-access-2010

How do I return a value of an entity in a table that is less than but closest to the value in another table for each element in the last table in SQL?

青春壹個敷衍的年華 提交于 2019-12-11 08:38:45
问题 I have two tables in MS Access and I am trying to add a field for one of those tables that tells which record from another table has a value that is less than the first field's value, but comes the closest? I have this query so far (just a select statement to test output and not alter existing tables), but it lists all values that are less than the querying value: SELECT JavaClassFileList.ClassFile, ModuleList.Module FROM JavaClassFileList, ModuleList WHERE ModuleList.Order<JavaClassFileList

excel and sql queries through different subs or functions

和自甴很熟 提交于 2019-12-11 08:11:28
问题 I have an excel sheet which i use with an access database. I want to open the database and use different sub routines with different queries. However i don't know hot to publically assign an variable to use the database so i have to create the connection within each subroutine and open and close this. I have a fealing that this must be able to do smarter so i don't have the same code written all over it. I open the database with the following code and have to do this over and over for every

Microsoft Access 2010 filtering data based on tempvar

谁都会走 提交于 2019-12-11 07:54:01
问题 i have a web database and im trying to filter a datasheet, based on the contents of a tempvar. Im trying to use the record source property of the datasheet to do this. I need to do this because, every employee that logs in should only be able to see a given subset of data in the products table. In the employee table, i have an extra column with a string value which is the data that particular employee should see. I have a login form that on clicking login, adds this string to the tempvars

Are Append Queries in a self joining table possible

吃可爱长大的小学妹 提交于 2019-12-11 06:48:16
问题 I have tblEmployee that contains 3 fields: ID : AutoNumber Name : Text Supervisor : Number [as a lookup in tblEmployee] I wish to append new data to this table from tblNewEmployees that has the exact same structure as the previous table. Can this be done if I have the ID field as an autonumber? I have tried various queries (for example first appending only the Name field as step 1, and then trying with a second update query to get the supervisor) but all produced garbage, hence my question

Why can't I specify criteria for a conditional query as a form component?

前提是你 提交于 2019-12-11 06:33:01
问题 I have two drop downs, Combo_A and Combo_B. I'm attempting to achieve a "cascading combo box" or "synchronous combo box" where a selection from Combo A (say, a US State) would populate Combo B (say a particular list of cities which belong to said state). I understand using the VBA code to do this, and the reason you'd prefer to use VBA, but my question is WHY must I use VBA. Simply making a conditional query with criteria of: [Forms]![Main_Form]![State_Dropdown] Doesn't seem to work. There IS

Find record with ID

核能气质少年 提交于 2019-12-11 06:28:02
问题 I'm trying to move to a record that has a certain ID. I tried the solution on this post: MS Access search for record by textbox instead of dropdown but no success Here's my code Private Sub btnShowPrevious_Click() Dim rs As DAO.Recordset Set rs = Me.RecordsetClone rs.FindFirst "[ID]=" & ParentID If rs.NoMatch Then MsgBox "Sorry, no such record '" & ParentID & "' was found.", _ vbOKOnly + vbInformation Else Me.Recordset.Bookmark = rs.Bookmark End If rs.Close End Sub It always hit no match but

Sorting error in one field of Report

匆匆过客 提交于 2019-12-11 06:14:17
问题 I have encounter an odd problem with a specific field which has the Field Name: Billing and is Datatype: Short Text. When I try to sort alphabetically the result on the Report is actually based on a corresponding field that is datatype Autonumber and also serves as the tables primary key. All other fields in the report sort just fine. I would like to think I have tried the usual corrections, but may have missed one and I am hoping someone can point this out if that is the case. Generally I

Access form - how to make text field have a control source from a SQL query?

廉价感情. 提交于 2019-12-11 06:09:42
问题 Background I have two tables: Projects EmployeeID Employee EmployeeID Name I have a query I am basing a form on containing, among other items: SELECT e.Name FROM Projects p JOIN Employee e ON e.EmployeeID=p.EmployeeID When I make a form in Access based on this query, I can very easily display e.Name on my form because it is joined from the query. My real example is of course considerably more complicated than this simple example. The above works fine for read-only queries and scales well.

Trying to insert into access database via SQL getting ID from another table

时光毁灭记忆、已成空白 提交于 2019-12-11 05:47:20
问题 I have 2 tables in an Access database: tblMachine fields: MachineID MachineDescription tblProblem fields ProblemID MachineID ProblemDescription I am trying to add a new record into tblProblem, using the MachineDescription to find the MachineID from tblMachine However, my SQL statement throws an error on the sub-select statement Here is my statement: string sql = "INSERT INTO tblProblem" + " ([MachineID], [ProblemDescription], [ProblemOrder])" + " VALUES (" + "(SELECT ([MachineID] FROM

Ms Access 2010 issue with a where clause in C#

本秂侑毒 提交于 2019-12-11 05:43:38
问题 I have a complex select statement for an Access 2010 database which grabs data from multiple tables using several LEFT JOIN statements. The query works as expected and I get the entire table. So now I want to add search functionality. One way was to add a WHERE clause at the end of the query and reference one of the JOIN ed tables' text field and compare it against some text ( WHERE [All Names].Name LIKE "*Mark*" ). Second option I tried was select * from (**complex sql here**) where *