Hi Mikey,

I think i'm a lot closer to geting where I need to be.. I have setup the following code below:

       private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row = dataGridView1.SelectedRows[0];
            //int CustomerID = Convert.ToInt32(row.Cells[0].Value);
            string CustomerID = row.Cells[0].Value.ToString();

            cashCustom.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Orders.mdb";
            cashOrdersDS = new DataSet();
            cashOrdersTable = new DataTable();
            cashOrdersDS.Tables.Add(cashOrdersTable);

            cashCustom.Open();
            cashCustom.Close();

            String cashOrdersSQL = "SELECT * FROM cashOrders INNER JOIN cashCustomers ON cashOrders.cashAccountRef_FKID=cashCustomers.CashAccRef WHERE cashCustomers.CashAccRef = " + CustomerID;
            cashDA = new System.Data.OleDb.OleDbDataAdapter(cashOrdersSQL, cashCustom);
            cashDA.Fill(cashOrdersTable);

            dataGridView2.DataSource = cashOrdersTable;
            dataGridView2.Columns.Remove("ID");
            dataGridView2.Columns.Remove("cashAccountRef_FKID");

            MessageBox.Show(CustomerID.ToString());
        }

When stepping through it I can physically see the CustomerID field being picked up and then it steps through until it errors at "cashDA.Fill(cashOrdersTable);"

I don't know if it's someting to do with the CustomerID being declared as an INT or a string (tried both an same error)

Error is in Screenshot.

I can smell victory in this problem!

P.S. = Just Checked the SQL Command in Server Studio and works fine

Whats the CashAccRef declared as in the database? What type? As I assume its going to be a mismatch between what you are passing and what it expects.

Scrap that.. I'm an idiot I still had access open when trying to code out.

Still same issue. Access is set to say 'Long Number' which I am guessing is Int64 which I have changed it to but still no worky.

Holly F*k Nuts I did it!

All sorted.. I have the customerAccRef_FKID set to Text. Changed that to INT and its working! WH000000!!

Thanks for being patient with me Mikey! I knew I would get there in the end! :) smug

P.S = Dont go anywhere though.. I might need you help in future issues :)

Hehe good to see you got there in the end :)!

Yeah dont' worry I won't be going anywhere, need something to pass the time at work when its quiet ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.