Enter Parameter??? eh?

  • Thread starter Thread starter john
  • Start date Start date
J

john

hi im useing the following code to check the state of a tick box (wich is
set to 2 states)
code start;
Dim closedoff As Variant
Dim stDocName As String
Dim stLinkCriteria As String
closedoff = DLookup("[closed/resolved?]", "eventlogs",
"[closed/resolved?]=off")

On Error GoTo Err_command84_Click

stDocName = "eventclose"

stLinkCriteria = "[Closed/Resolved?]=off" & "" & Me![Closed/Resolved?] &
""
If (closedoff) = 0 Then GoTo proceed
If IsNull(closedoff) Then GoTo abort 'skip open if marked
closed/resolved
proceed:
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_command84_Click:
Exit Sub

Err_command84_Click:
MsgBox Err.Description
Resume Exit_command84_Click
abort:

DoCmd.Close acForm, "eventclose"
MsgBox "There Is No Events To Close or all are Resolved"
Exit Sub
End Sub

code end

i know its not the best way to do things but its the only way i can get my
head around it at the moment
the only problem i get is if the current record is being edited i get a
paramiter box with the title 'off0' ive but an extra bit of code in so when
the form closes it resets the filter to null but i'll still get the 'enter
paramiter' box if the current record is being eddited, the command button
wich executes this code is on the same form as the data entry form (its kind
of like a tool section)
i think its got some thing to do with the stlinkcriteria and the closedoff
parts other than that its working fine

can some one tell me whats wrong with the code

thanks in advance
john
 
Er ... !

Assuming you have a command button named Command84:

sub Command84_Click (...)
if nz (DLookup(true, "eventlogs", "[closed/resolved?]=false"), false)
msgbox ("There are one or more unclosed records")
else
msgbox "There are no records, or no unclosed records"
endif
end sub

Check the parameters for the Click event - I can't remember, & don't have
Access here to check. Note the quoting in the dlookup statement: some of the
trues and falses are quoted, >some of them aren't<.

HTH,
TC
 
Back
Top