I have a piece of code connecting to my database retrieving data. I was just testing the form on another computer and everytime it loads this specific form it closes the form. Anyone know why it would do that?
You can see the lines I had to comment out in order for the form to NOT close on load. Is there something possibly that needs to be installed on this other computer? running XP pro 32 bit.
Code:Dim conn As OleDbConnection Dim comm As OleDbCommand Dim dr As OleDbDataReader Dim connectionString As String Dim sql As String connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=database.mdb;" sql = "SELECT * FROM table WHERE ID = (SELECT MAX(ID) FROM table)" conn = New OleDbConnection(connectionString) 'conn.Open() comm = New OleDbCommand(sql, conn) 'dr = comm.ExecuteReader() 'conn.Close() 'dr.Close() comm.Dispose() conn.Dispose()




Reply With Quote