Combine rows / concatenate rows

Here is a sample User Defined Function (UDF) and possible usage. Function: Function Coalsce(strSQL As String, strDelim, ParamArray NameList() As Variant) Dim db As Database Dim rs As DAO.Recordset Dim strList As String Set db = CurrentDb If strSQL <> “” Then Set rs = db.OpenRecordset(strSQL) Do While Not rs.EOF strList = strList & strDelim … Read more

Microsoft.ACE.OLEDB.12.0 provider is not registered

Basically, if you’re on a 64-bit machine, IIS 7 is not (by default) serving 32-bit apps, which the database engine operates on. So here is exactly what you do: 1) ensure that the 2007 database engine is installed, this can be downloaded at: http://www.microsoft.com/downloads/details.aspx?FamilyID=7554F536-8C28-4598-9B72-EF94E038C891&displaylang=en 2) open IIS7 manager, and open the Application Pools area. On … Read more

Using parameters inserting data into access database

Same as for any other query: a) Replace actual hardcoded parameters in your OleDbCommand with placeholders (prefixed with @), b) Add instances of OleDbParameter to the DbCommand.Parameters property. Parameter names must match placeholder names. [WebMethod] public void bookRatedAdd(string title, int rating, string review, string ISBN, string userName) { using (OleDbConnection conn = new OleDbConnection( “Provider=Microsoft.Jet.OleDb.4.0;”+ … Read more

How to add default signature in Outlook

The code below will create an outlook message & keep the auto signature Dim OApp As Object, OMail As Object, signature As String Set OApp = CreateObject(“Outlook.Application”) Set OMail = OApp.CreateItem(0) With OMail .Display End With signature = OMail.body With OMail ‘.To = “[email protected]” ‘.Subject = “Type your email subject here” ‘.Attachments.Add .body = “Add … Read more

SQL multiple join statement

For multi-table joins, you have to nest the extra joins in brackets: SELECT … FROM ((origintable JOIN jointable1 ON …) JOIN jointable2 ON …) JOIN jointable3 ON … basically, for every extra table you join past the first, you need a bracket before the original ‘FROM’ table, and a closing bracket on the matching JOIN … Read more

Combine values from related rows into a single concatenated string value

This is easy using Allen Browne’s ConcatRelated() function. Copy the function from that web page and paste it into an Access standard code module. Then this query will return what you asked for. SELECT i.N_ID, i.F_Name, i.L_Name, ConcatRelated( “Course_ID”, “tbl_Courses”, “N_ID = ‘” & [N_ID] & “‘” ) AS Course_IDs FROM tbl_Instructors AS i; Consider … Read more