Link to home
Start Free TrialLog in
Avatar of Balshe
Balshe

asked on

DataEnvironment and check If record Exist??

I try to check if a record exists before adding new Record
and after the find Line i get this error:

" Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another."

the command Properties:
CommandType=AdcmdTable
CurserLoaction=aduseserver
CursorType=adopenKeyset
LockType=adlLockOptimistic

What is wrong?????
 

With DataEnvironment1.rsCmdSchema
If Not .BOF Then .MoveFirst
    .Find "[Schema] ='" & Trim(txtSchema) & "'" & "   and      [Stage_id]=" & CmbStage.ItemData(CmbStage.ListIndex), , adSearchForward
   
    If Not .EOF Then
        MsgBox "Record Already Exists" & vbCrLf & vbCrLf & "Pls Write New Schema Name Or Stage"
        PutFocus txtSchema
        Exit Sub
    End If
            .AddNew
            !Schema = Trim(txtSchema)
            !stage_id = Val(CmbStage.ItemData(CmbStage.ListIndex))
           .Update
           RsChanged = True
End With
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

The Find method accepts only one criteria.
Have a look at Filter (it accepts more then one criteria).
Avatar of Balshe
Balshe

ASKER

can u tell me how would it look like?

i would be greatful
thank u
Avatar of Balshe

ASKER

i mean if u could write  a code helping me to understand how??????
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial