Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Funny Problem with Controls

Status
Not open for further replies.

fabby1

Technical User
Mar 9, 2004
206
GB
Hi

I have a form that works perfectly......

Until I try and add a new text box

as soon as I do I get the following when I use the combox.

Code:
Run-time '2467'

The expression you entered refers to an object that is closed or doesn't exist.

BUT IT DOES

because 5 seconds earlier before I added the text box it worked !!!

The After_Update event is

Code:
Private Sub cmb_Search_AfterUpdate()
   ' Find the record that matches the control.
    Dim rs As Object
    
    G_STAFFNO = Me.cmb_Search.Value

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[STAFFNO] = '" & Me![cmb_Search] & "'"
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    
    For Each ctrl In Forms(G_CalledForm).Detail.Controls
         CtrlName = ctrl.Name
         If Left(CtrlName, 3) = "as_" Then
           Forms(G_CalledForm).Detail.Controls(CtrlName).Visible = True
           End If
    Next ctrl
  
End Sub


It still doesn't work then after I delete the control I have just entered

Any Ideas

Phil
 
Did you in the mean time close the forms and reopen them?

- just guessing your global form name variable lost it's value while you where adding/deleting controls...

Roy-Vidar
 
Hi Roy

Yes Tried that, have saved and reloaded the form and checked in debug when I get the error and G_CalledForm has the name of the form so does CtrlName, the name of the control is says it can't find !!


Thanks

Phil
 
Roy

If I delete the control save and reload it works.

Phil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top