I have 2 forms one called frmCompanyDetails and frmCompanyDetails2.When I say rs1.Update in the first form VB hangs.
the code is given below..
form1 code
Private rs1 As New ADODB.Recordset
Private con As New ADODB.Connection
Private Sub commandNext_Click()
If txtName.Text = "" Then
rvalue = MsgBox("Enter a Name: ", vbApplicationModal + vbInformation + vbCritical, "Correction"

Exit Sub
End If
If IsDate(txtDOS.Text) Then
hello = 1
Else
rvalue = MsgBox("Enter a valid date.", vbApplicationModal + vbCritical + vbOKOnly, "Correction"

Exit Sub
End If
If txtAddress.Text = "" Then
rvalue = MsgBox("Enter a value for Address: ", vbApplicationModal + vbInformation + vbCritical, "Correction"

Exit Sub
End If
If txtProjects.Text = "" Then
rvalue = MsgBox("Enter a value Projects: ", vbApplicationModal + vbInformation + vbCritical, "Correction"

Exit Sub
End If
If txtWeb.Text = "" Then
rvalue = MsgBox("Enter a value for Web Address: ", vbApplicationModal + vbInformation + vbCritical, "Correction"

Exit Sub
End If
If txtHead.Text = "" Then
rvalue = MsgBox("Enter a value for Head Office Address: ", vbApplicationModal + vbInformation + vbCritical, "Correction"

Exit Sub
End If
If txtHR.Text = "" Then
rvalue = MsgBox("Enter a H R Name: ", vbApplicationModal + vbInformation + vbCritical, "Correction"

Exit Sub
End If
If txtPhone.Text = "" Then
rvalue = MsgBox("Enter a value for Phone Number : ", vbApplicationModal + vbInformation + vbCritical, "Correction"

Exit Sub
End If
rs1.AddNew
rs1.Fields(0) = txtName.Text
rs1.Fields(1) = txtAddress.Text
rs1.Fields(2) = txtProjects.Text
rs1.Fields(3) = txtDOS.Text
rs1.Fields(4) = txtWeb.Text
rs1.Fields(5) = txtHead.Text
rs1.Fields(6) = txtHR.Text
rs1.Fields(7) = " "
rs1.Fields(8) = txtPhone.Text
rs1.Fields(9) = txtEmail.Text
rs1.Update
rs1.Close
frmCompanyDetails.Hide
frmCompanyDetails2.Show
End Sub
Private Sub Form_Load()
With con
.Open " Provider=MSDAORA.1;User ID=6csa2-20;PASSWORD=sem;Data Source=orcl"
End With
With rs1
.ActiveConnection = con
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Source = "company"
.Open
End With
txtName.Text = ""
txtAddress.Text = ""
txtProjects.Text = ""
'txtDOS.Text = ""
txtWeb.Text = ""
txtHead.Text = ""
txtHR.Text = ""
txtPhone.Text = ""
txtEmail = ""
End Sub
form2 code
Dim con1 As New ADODB.Connection
Dim rs1 As New ADODB.Recordset
Private Sub cmdAdd_Click()
If Combo1.Text = "Select Course Name" Then
rvalue = MsgBox("Please Select a course name ", vbApplicationModal + vbInformation + vbCritical, "Correction"

Exit Sub
End If
If Combo2.Text = "Select Branch Name" Then
rvalue = MsgBox("Please select a branch name ", vbApplicationModal + vbInformation + vbCritical, "Correction"

Exit Sub
End If
rs1.Fields(0) = frmCompanyDetails.txtName.Text
rs1.Fields(1) = Combo1.Text
rs1.Fields(2) = Combo2.Text
Me.Hide
Exit Sub
End Sub
Private Sub Form_Load()
With con
.Open " Provider=MSDAORA.1;User ID=6csa2-20;PASSWORD=sem;Data Source=orcl"
End With
With rs1
.ActiveConnection = con1
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Source = "branches"
.Open
End With
End Sub
Private Sub Combo1_Click()
If Combo1.Text = "BE" Then
Combo2.Visible = True
Combo2.Clear
Combo2.Text = "Select Branch Name"
Combo2.AddItem ("Computer Science"

Combo2.AddItem ("Electrical and Electronics"

Combo2.AddItem ("Electronics and Communication"

Combo2.AddItem ("Information Science"

Combo2.AddItem ("Mechanical"

Combo2.AddItem ("Medical Electronics"

Combo2.AddItem ("Instrumentation"

Combo2.AddItem ("Civil"

Combo2.AddItem ("Architecture"

Combo2.AddItem ("Telecommunication"

Combo2.AddItem ("IEM"

Combo2.AddItem ("Chemical"

End If
If Combo1.Text = "MBA" Then
Combo2.Clear
Combo2.Text = "Select Branch Name"
Combo2.Visible = True
Combo2.AddItem ("Systems"

Combo2.AddItem ("Marketing"

Combo2.AddItem ("Finance"

Combo2.AddItem ("HR"

End If
If Combo1.Text = "MTech" Then
Combo2.Clear
Combo2.Text = "Select Branch Name"
Combo2.Visible = True
Combo2.AddItem ("Civil"

Combo2.AddItem ("Computer Science"

Combo2.AddItem ("Mechanical"

End If
If Combo1.Text = "MCA" Then
Combo2.Visible = False
flag = 1
End If
End Sub