Dear all,
this peace fo code is not working, enntering into table records through looping for a given value(limit):
a - is value that user enters(selects from combo in this case), so adding of records should end to this up to this value.
This code below is looping to the end is not stoping to the given value !???!
Private Sub Save_Click()
Dim a, b As Double
a = Val(Combo1.Text)
b = 1
While Not (b >= a)
If Text1.Text = "" Then
MsgBox "Please enter the name of the Village.."
Text1.SetFocus
Exit Sub
ElseIf Combo2.Text = "" Then
MsgBox "Please select a Municipality."
Exit Sub
End If
If Text2 <> "" Then
If Not IsNumeric(Text2.Text) Then
MsgBox "The Surface you entered is invalid!"
Exit Sub
End If
End If
Dim rstAdd As New ADODB.Recordset
Dim adoAdd As New ADODB.Connection
Dim strMun As String
adoAdd.Open "PROVIDER=MSDASQL;dsn=idp;uid=;pwd=;database=IDPSurvey;"
adoAdd.Execute "insert into Lands values('" & Text3 & "','" & Text1 & "', '" & _
Combo2 & "', '" & Text2 & "')"
Me.Text1 = ""
Me.Combo2 = ""
Me.Text2 = ""
adoAdd.Close
b = b + 1
Wend
MsgBox "Saving finished, you have reached maximum of parcels", vbCritical, "Author : ZuZa"
Unload Me
End Sub
Regards,
ZuZa
this peace fo code is not working, enntering into table records through looping for a given value(limit):
a - is value that user enters(selects from combo in this case), so adding of records should end to this up to this value.
This code below is looping to the end is not stoping to the given value !???!
Private Sub Save_Click()
Dim a, b As Double
a = Val(Combo1.Text)
b = 1
While Not (b >= a)
If Text1.Text = "" Then
MsgBox "Please enter the name of the Village.."
Text1.SetFocus
Exit Sub
ElseIf Combo2.Text = "" Then
MsgBox "Please select a Municipality."
Exit Sub
End If
If Text2 <> "" Then
If Not IsNumeric(Text2.Text) Then
MsgBox "The Surface you entered is invalid!"
Exit Sub
End If
End If
Dim rstAdd As New ADODB.Recordset
Dim adoAdd As New ADODB.Connection
Dim strMun As String
adoAdd.Open "PROVIDER=MSDASQL;dsn=idp;uid=;pwd=;database=IDPSurvey;"
adoAdd.Execute "insert into Lands values('" & Text3 & "','" & Text1 & "', '" & _
Combo2 & "', '" & Text2 & "')"
Me.Text1 = ""
Me.Combo2 = ""
Me.Text2 = ""
adoAdd.Close
b = b + 1
Wend
MsgBox "Saving finished, you have reached maximum of parcels", vbCritical, "Author : ZuZa"
Unload Me
End Sub
Regards,
ZuZa