By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,471 Members | 711 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,471 IT Pros & Developers. It's quick & easy.

Proper Use of Requery

P: n/a
Can someone explain to me the proper syntax for requery and where to
input it in my form?

I have a main form "Account-Master" with two subforms: 1.) Contacts
and 2.)TNotes.

The TNotes subform has a list of notes related to the Account-Master
record (a relationship has been established based on the field
CompanyID which exists in both tables).

To add a new record to the TNotes form, I've added a button that opens
another form called "NoteAdd". When the user finishes creating a new
note, there's a button on the "NoteAdd form" that returns them to the
TNote subform...but my new record doesn't show up until I move to the
next record in the "Account-Master" file & then go back.

I've done a bunch of research and it seems that I need to use
'Requery' somewhere to be able to see the new record on the TNotes
subform when I return to it. The problem is, I cannot figure out the
right syntax or the place to put the code so that it works properly.

Do I put the code in the property for the subform TNote? If so, which
event property does it go in? Or maybe I need to put the code in the
existing code for the button that takes you from my data entry form
back to the TNote subform? Or maybe...

Can anyone out there help me out?

Mar 9 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
in the on-click or on-exit event of the button on the form 'NoteAdd'
try

Forms![frmAccount-Master]![sbfrmTNotes].ReQuery

bobh.
On Mar 9, 3:38 pm, "Swinky" <swinkel...@lunt.comwrote:
Can someone explain to me the proper syntax for requery and where to
input it in my form?

I have a main form "Account-Master" with two subforms: 1.) Contacts
and 2.)TNotes.

The TNotes subform has a list of notes related to the Account-Master
record (a relationship has been established based on the field
CompanyID which exists in both tables).

To add a new record to the TNotes form, I've added a button that opens
another form called "NoteAdd". When the user finishes creating a new
note, there's a button on the "NoteAdd form" that returns them to the
TNote subform...but my new record doesn't show up until I move to the
next record in the "Account-Master" file & then go back.

I've done a bunch of research and it seems that I need to use
'Requery' somewhere to be able to see the new record on the TNotes
subform when I return to it. The problem is, I cannot figure out the
right syntax or the place to put the code so that it works properly.

Do I put the code in the property for the subform TNote? If so, which
event property does it go in? Or maybe I need to put the code in the
existing code for the button that takes you from my data entry form
back to the TNote subform? Or maybe...

Can anyone out there help me out?

Mar 9 '07 #2

P: n/a
Thanks bobh, that almost got me there. I had to modify the syntax
cause I kept getting an error, but finally got it to work with:

Forms![Account-Master]![TNotes].ReQuery

I put the code in the on-exit command and it works great!

Thanks

Mar 9 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.