I have the following code I'm trying to execute.
Private Sub cmdSave_Click()
Dim cnnLocal As New ADODB.Connection
Dim rstCurr As New ADODB.Recordset
Dim fldCurr As ADODB.Field
Dim strTest As String
strTest = "None"
Set cnnLocal = CurrentProject.Connection
If cboLocation = "Dallas" Then
rstCurr.Open "Select subdivision from tblDallasAcct where Builder = '" & txtbuilder & "'" & _
"and subdivsion = '" & txtSubdivision & "'", cnnLocal, adOpenKeyset, adLockPessimistic
With rstCurr
Do Until .EOF
For Each fldCurr In .Fields
strTest = fldCurr.Value
Next
.MoveNext
Loop
End With
If strTest = "None" Then
'DoCmd.SetWarnings False
DoCmd.OpenQuery "qappNewDalAcct"
'DoCmd.SetWarnings True
Else
MsgBox "Subdivion already in table"
End If
rstCurr.Close
End If
End Sub
At the rstCurr.Open sql stament it gives me the following error: No value given for one or more required parameters. I actually copied the majority fo this code from an earlier database that I created, then renamed everything appropriately, so I am at a loss as to what is wrong.
Lory
Private Sub cmdSave_Click()
Dim cnnLocal As New ADODB.Connection
Dim rstCurr As New ADODB.Recordset
Dim fldCurr As ADODB.Field
Dim strTest As String
strTest = "None"
Set cnnLocal = CurrentProject.Connection
If cboLocation = "Dallas" Then
rstCurr.Open "Select subdivision from tblDallasAcct where Builder = '" & txtbuilder & "'" & _
"and subdivsion = '" & txtSubdivision & "'", cnnLocal, adOpenKeyset, adLockPessimistic
With rstCurr
Do Until .EOF
For Each fldCurr In .Fields
strTest = fldCurr.Value
Next
.MoveNext
Loop
End With
If strTest = "None" Then
'DoCmd.SetWarnings False
DoCmd.OpenQuery "qappNewDalAcct"
'DoCmd.SetWarnings True
Else
MsgBox "Subdivion already in table"
End If
rstCurr.Close
End If
End Sub
At the rstCurr.Open sql stament it gives me the following error: No value given for one or more required parameters. I actually copied the majority fo this code from an earlier database that I created, then renamed everything appropriately, so I am at a loss as to what is wrong.
Lory