Click here to Skip to main content
15,881,882 members

Exception.InnerException

sencsk asked:

Open original thread
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
Tags: Visual Basic (Visual Basic 8 (2005)), Microsoft, Microsoft Access

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900