refresh a subform

A

Amy Schmid

I have a form called "frm:FixedFeeEdit". On this form is an unbound box that
is called "lst:FixedFeeEdit". The unbound box is a list that looks at a
query "qry:FixFeeEdit" for data to populate the list in "table" format.

From our main menu, I choose the form "frm:FixFeeEdit" and the list of Fixed
Fee proposals populates. I have a button that allows the user to create a
new Fixed Fee Proposal record. After creating the record and returning to
the form, the form does not update with the added record.

How do I get that main form to update without having to go back to the menu
and then back to my form?
 
C

Chris

I have the same thing on a database that I created. This is the code I use
to refresh the list:

'This requeries the form and sets focus to the form.
Forms![Post GASP Data]![ListComputerID].Requery

"Post GASP Data" is the name of the form and "ListComputerID" is the name of
the listbox on the form. Note: The refresh may take a while depending on
the query behind the listbox.
 
C

Chris

Here are some other items that may be helpful.


The first is used to determine if the listbox contains any records. If it
does, it sets focus to the first record in the list.

If Forms![Post GASP Data].Controls("ListComputerID").ListCount > 0 Then
'This sets forcus to the first record
Forms![Post GASP Data].Controls("ListComputerID").ListIndex = 0
End If

The second determines if the Listbox is null and takes action based on the
results of the IF statement.

'This checks for Nul record set and exits fucntion if true
If (IsNull(Forms![Post GASP Data]![ListComputerID])) Then
MsgBox "No New Computer Data to add to the GASP Database.",
vbInformation, "GASP Database"
Exit Function
Else

'This calls the referenced function to append the software records
Call AppendGASPComputerApplications
End If
 

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