Can't Requery Unbound Controls on a Form!!

A

Altemir

Got a weird problem ... I have a form in an ADP database and this form
has a "Clear" button that is supposed to reinitialize all the unbound
controls on the form. The code that I put in the OnClick event of the
Clear button is shown below.

The problem is that clicking the button is not clearing the form. I'm
obviously setting all the control values to null but the form doesn't
seem to be requerying them. What am I doing wrong?

Private Sub btnClear_Click()

Me!txtDocID = Null
Me!cboDocType = Null
Me!txtDocNumber = Null
Me!txtRevision = Null
Me!txtRevDate = Null
Me!txtTitle = Null
Me!txtFilePath = Null
Me!cboProgram = Null
Me!cboRespOrg = Null
Me!cboStatus = Null
Me!lblChangeStatus = Null

Me.Requery

End Sub
 
G

Guest

Altemir,

Just setting a controls value to NULL does not requery the combo box or
list. In order for that to occur, you have to use the Requery action for
that control.

If you have a combo box thats rowsource is based on values in text boxes on
the form then you must implement that Requery action similiar to:

me!cboProgram.requery

HTH
Dale
 
G

Guest

Take out the Me.Requery. It only applies to bound forms. What it is causing
is the combos to requery. That should do it. It has been a long time since
I worked with unbound forms because they take way too much coding, but it may
be necessary to requery them individually if their row source is a table or
query. If they use a value list, setting them to Null should work.
Like
Me!cboProgram.Requery

If they use a value list, setting them to Null should work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top