Is it possible to pass parameters programmatically in a Microsoft Access update query?

I just tested this and it works in Access 2010. Say you have a SELECT query with parameters: PARAMETERS startID Long, endID Long; SELECT Members.* FROM Members WHERE (((Members.memberID) Between [startID] And [endID])); You run that query interactively and it prompts you for [startID] and [endID]. That works, so you save that query as [MemberSubset]. … Read more

OleDbCommand parameters order and priority

According to http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbcommand.parameters.aspx OleDbCommand does not support named parameter The OLE DB .NET Provider does not support named parameters for passing parameters to an SQL statement or a stored procedure called by an OleDbCommand when CommandType is set to Text. In this case, the question mark (?) placeholder must be used. For example: SELECT * … Read more

Multiple INNER JOIN SQL ACCESS

Access requires parentheses in the FROM clause for queries which include more than one join. Try it this way … FROM ((tbl_employee INNER JOIN tbl_netpay ON tbl_employee.emp_id = tbl_netpay.emp_id) INNER JOIN tbl_gross ON tbl_employee.emp_id = tbl_gross.emp_ID) INNER JOIN tbl_tax ON tbl_employee.emp_id = tbl_tax.emp_ID; If possible, use the Access query designer to set up your joins. … Read more

What’s the difference between DoCmd.SetWarnings and CurrentDB.Execute

They do not both mask errors. DoCmd.SetWarnings masks errors and is system wide, not confined to the single application that you are using. DoCmd.SetWarnings False without the corresponding DoCmd.SetWarnings True will mean that action queries will run without any prompts in any Access application on the PC. Execute does throw warnings, the warnings that you … Read more

How to get matching data from another SQL table for two different columns: Inner Join and/or Union?

(The following applies when every row is SQL DISTINCT, and outside SQL code similarly treats NULL like just another value.) Every base table has a statement template, aka predicate, parameterized by column names, by which we put a row in or leave it out. We can use a (standard predicate logic) shorthand for the predicate … Read more