i understand what you are getting at but am not sure how to combine with what
i already have. Originally my plan was to have two forms one with items that
could be edited and another that could not and open accordingly. But i came
across this bit of code and adapted to my problem but am still going to be
stuck with two forms.
Private Sub cmdsome_Click()
Dim strWhere As String, varItem As Variant
' Request to edit items selected in the list box
If Me!listcmrequests.ItemsSelected.Count = 0 Then Exit Sub
For Each varItem In Me!listcmrequests.ItemsSelected
strWhere = strWhere & Me!listcmrequests.Column(0, varItem) & ","
Next varItem
strWhere = Left$(strWhere, Len(strWhere) - 1)
strWhere = "[CMRID] IN (" & strWhere & ")"
DoCmd.OpenForm FormName:="qrycminfo", WhereCondition:=strWhere
DoCmd.Close acForm, Me.Name
End Sub
--
Crane
Marshall Barton said:
Crane said:
I have a list of records that have a "no Revision Allowed" check box. I would
like to use a list box so the user can select a record and then open it up in
a form. However, records with the "no revision allowed" checked should be
open up in the form as read only. The others can be opened as editable. Any
help is appreciated
Check VBA Help on the OpenForm method and its DataMode
argument.
If Me.[no Revision Allowed] = False Then
DoCmd.OpenForm "the form", _
DataMode:=acFormEdit,
WhereCondition:= "pkfield=" & Me.pkfield
Else
DoCmd.OpenForm "the form", _
DataMode:= acFormReadOnly,
WhereCondition:= "pkfield=" & Me.pkfield
End If