Link to home
Start Free TrialLog in
Avatar of Fordraiders
FordraidersFlag for United States of America

asked on

I need to make a check in a field to see if more than One number exists in the field

Access 2010  VBA

I need to make a check in a field to see if more than One number exists in the field.
Field1

' Currently i check for blank values in that field.
after that check is completed, I need to see if any number variations exists.

Field1 should contain the same number

Example:
Field1
2321
2321
2321
etc...


If this exists:
2321
2322
2321
2324

Then I need to stop the routine with a message nox !
Dim R As DAO.Recordset
' NOW LOOK TO SEE FOR NULL RECORDS?
Set R = CurrentDb.OpenRecordset("SELECT * FROM [escalation_detail] ", dbOpenDynaset, dbSeeChanges)
' any ID nulls ?
R.MoveLast
R.MoveFirst
While Not R.EOF
If IsNull(R.Fields(1).Value) Then
   MsgBox "You Have Blank Record IDS. Double Check Your Import!", vbCritical
   R.Close
   Set R = Nothing
   Exit Sub
End If
R.MoveNext
Wend

Open in new window


Thanks
fordraiders
ASKER CERTIFIED SOLUTION
Avatar of Gustav Brock
Gustav Brock
Flag of Denmark 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
SOLUTION
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
Avatar of Fordraiders

ASKER

Thanks Folks !! Either Solution will work well.
Should have thought of that.
fordraiders
Thanks Folks !
Sounds like a design problem.  If all child records are supposed to contain the same value, then the field does NOT belong in that table.  It belongs in the parent table.