Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB8.0 Access Microsoft
Hello...

i'm very beginner in vb2008. i need to connect two forms with ms access. first form is connect with second using(form2.show). my need is when i execute the coding. i got a error on first form " An error occurred creating the form. See Exception.InnerException for details. The error is: Operation is not allowed when the object is closed. "
How can i solve the issue..
 
and also add,update, delete from database..
 

This is my codes:
 
this is first form:
 
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Dim form As Form3
 

Form3.Show()
 
this is my second form:
 
Dim conn As New ADODB.Connection
Dim connectionString
Dim DB As DataSet
Dim instace As MissingSchemaAction
Dim rs As New ADODB.Recordset
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles can.Click
 

Me.Close()
Form2.Close()
 
End Sub
 
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'On Error Resume Next
 
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\db1.mdb;Persist Security Info=False"
conn.Open(connectionString)
 
rs.Open("insert into table1(Name,Address,Contact_Number,vat) values ('" & snm.Text & "','" & sadd.Text & "'," & Val(scno.Text) & " , " & Val(svat.Text) & ")", conn)
 
'rs.Open("insert into table1(Id,Name,Address,Contact_Number,vat) values ('2','sam','abc street','22','12')", conn)
rs = Nothing
MsgBox("account saved")
End Sub
 
help me plz.. urgent
 

Plz help me..
thank you
Posted 9-Jul-10 3:33am
sencsk1.2K
Edited 10-Jul-10 4:05am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

No one is going to be able to provide you with an answer without seeing your code. You haven't even told us what "when the object is closed" is referring to. What object? Are you doing a database operation without opening the connection first? We need to see the code where the error was thrown or we can't help.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Make sure you are connecting to the database correctly and that your connection remains open.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 BillWoodruff 330
1 Mathew Soji 309
2 Maciej Los 295
3 DamithSL 225
4 Afzaal Ahmad Zeeshan 217
0 OriginalGriff 6,369
1 Sergey Alexandrovich Kryukov 5,973
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,025


Advertise | Privacy | Mobile
Web03 | 2.8.1411019.1 | Last Updated 10 Jul 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100