2426 Sikh Philosophy Network - View Single Post - Yes/No field in a table-Make exclusive or default?
View Single Post
  #3 (permalink)  
Old 12-Nov-2005, 22:40 PM
Karl H's Avatar Karl H
Guest
 
Posts: n/a
   
   
RE: Yes/No field in a table-Make exclusive or default?

Hi Sprinks,
After connecting the checkbox to the yes/no data field in the table, that
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/7246-yes-no-field-table-make-exclusive.html
worked great. Thank you very much! Have a good wknd!
Karl

"Sprinks" wrote:

> Karl,
>
> Validation rules apply to the data in the current record, so it can't be
> used. But you can loop through the recordset, and accomplish this in the
> checkbox' AfterUpdate event:
>
> ' If field in current record is checked, set all others to false,
> ' essentially creating a multi-record option group.
> On Error Resume Next
>
> Dim rst As DAO.Recordset
> Dim intindex As Integer
>
> ' Remember ID of current record
> intindex = Me!YourPrimaryKeyID
>
> If Me!YourCheckBox = True Then
>
> ' Create recordset clone, loop through all records
> Set rst = Me.RecordsetClone
> rst.MoveFirst
>
> Do Until rst.EOF
> If rst![YourPrimaryKeyID] <> intindex Then
Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=7246
> With rst
> .Edit
> !YourYesNoField = False
> .Update
> End With
> End If
> rst.MoveNext
> Loop
>
> ' Clean up
> Set rst = Nothing
>
> End If
>
> Sprinks
>
>
>
> "Karl H" wrote:
>
> > Hi,
> > Can you have a yes/no field in a table that will have a validation rule that
> > only one rowsource can have the "yes" choice selected? This would allow for
> > declaring that row source the default.
> >
> > The validation rule would need to state, If "yes", then all other records in
> > the same table = no.
> >
> > Is this possible? What would the expression for the validation rule be?
> >
> > THank you,
> > Karl

Reply With Quote
 
Page generated in 0.14260 seconds with 25 queries
0