It's been awhile since I did any vb programing and I am having some trouble getting my function to work correctly. I need to select from my Centers table a field called "nositeplan" the value is "no". If the field has a "no" in it I want to hide my command button. But I get a error"variable not defined"
I am sure I have forgotten something very simple but I don't remember what it is. This is probably and easy one.![]()
Code:'added no site plan rule Public Sub nositeplan() On Error GoTo Err_handler Dim sSQL As String Screen.MousePointer = vbHourglass Call CreateConnection Set objRs = New ADODB.Recordset objRs.ActiveConnection = objConn objRs.CursorLocation = adUseClient objRs.CursorType = adOpenForwardOnly objRs.LockType = adLockReadOnly objRs.Source = "select * from centers where nositeplan = 'no'" 'MsgBox objRs.Source objRs.Open 'CHECK FOR nositeplan and set command button visible to false If no > 1 Then HoverCommand12.Visible = False Else HoverCommand12.Visible = True End If objRs.Close Set objRs = Nothing Call CloseConnection End If Screen.MousePointer = vbDefault End Sub




Reply With Quote