PC Review


Reply
Thread Tools Rate Thread

How do you requery to make data available for use?

 
 
John F
Guest
Posts: n/a
 
      22nd Jul 2009
Table "A" is the data for form "A".
Table "B" is the data for subform "B".
Table "C" is a lookup for a field in table "B".
Form "A" is a regular form.
Form "B" is a datasheet style form.

Control button on form "A" which opens a form to update contents of table "C".
After closeing the form from which table "C" was eddited how do you requery
to make the newly added information to the lookup is available for use?

DoCmd.Requery does not work.
DoCmd.Requery sfrmBookAuthor does not work.
 
Reply With Quote
 
 
 
 
Dirk Goldgar
Guest
Posts: n/a
 
      22nd Jul 2009
"John F" <(E-Mail Removed)> wrote in message
news:7498E35B-814B-4DF0-ABA3-(E-Mail Removed)...
> Table "A" is the data for form "A".
> Table "B" is the data for subform "B".
> Table "C" is a lookup for a field in table "B".
> Form "A" is a regular form.
> Form "B" is a datasheet style form.
>
> Control button on form "A" which opens a form to update contents of table
> "C".
> After closeing the form from which table "C" was eddited how do you
> requery
> to make the newly added information to the lookup is available for use?
>
> DoCmd.Requery does not work.
> DoCmd.Requery sfrmBookAuthor does not work.



You need to requery the control on the subform that uses table C as its
rowsource. You haven't named that control, though. Suppose that its name
is "D". Then the general form of the statement is:

Forms!A!B.Form!D.Requery

That is assuming that "B" is actually the name of the subform control on A
that displays the form object "B". That may not be the case; you should
check.

If the statement would be executed in the module of form A, you can
short-cut it like this:

Me.B.Form!D.Requery

Note, though, that if you are using the same event procedure (on form A) to
open the form that edits C and then requery the control, you'll need to open
that form in dialog mode; e.g.,

DoCmd.OpenForm "FormToEditC", WindowMode:=acDialog
Me.B.Form!D.Requery


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
John F
Guest
Posts: n/a
 
      22nd Jul 2009
Thanks problem solved. But now this brings up another question.

Private Sub Command11_Click()

refind = BookID
Forms!frmBooks!frmBookAuthor!Authors.Requery
Forms!frmBooks.Requery
DoCmd.GoToRecord , "frmBooks", , refind

End Sub

With the above code why does it go to the record after the one stored in
refind?



"Dirk Goldgar" wrote:

> "John F" <(E-Mail Removed)> wrote in message
> news:7498E35B-814B-4DF0-ABA3-(E-Mail Removed)...
> > Table "A" is the data for form "A".
> > Table "B" is the data for subform "B".
> > Table "C" is a lookup for a field in table "B".
> > Form "A" is a regular form.
> > Form "B" is a datasheet style form.
> >
> > Control button on form "A" which opens a form to update contents of table
> > "C".
> > After closeing the form from which table "C" was eddited how do you
> > requery
> > to make the newly added information to the lookup is available for use?
> >
> > DoCmd.Requery does not work.
> > DoCmd.Requery sfrmBookAuthor does not work.

>
>
> You need to requery the control on the subform that uses table C as its
> rowsource. You haven't named that control, though. Suppose that its name
> is "D". Then the general form of the statement is:
>
> Forms!A!B.Form!D.Requery
>
> That is assuming that "B" is actually the name of the subform control on A
> that displays the form object "B". That may not be the case; you should
> check.
>
> If the statement would be executed in the module of form A, you can
> short-cut it like this:
>
> Me.B.Form!D.Requery
>
> Note, though, that if you are using the same event procedure (on form A) to
> open the form that edits C and then requery the control, you'll need to open
> that form in dialog mode; e.g.,
>
> DoCmd.OpenForm "FormToEditC", WindowMode:=acDialog
> Me.B.Form!D.Requery
>
>
> --
> Dirk Goldgar, MS Access MVP
> www.datagnostics.com
>
> (please reply to the newsgroup)
>

 
Reply With Quote
 
Dirk Goldgar
Guest
Posts: n/a
 
      22nd Jul 2009
"John F" <(E-Mail Removed)> wrote in message
news:4315B7F8-1904-494F-B3BB-(E-Mail Removed)...
> Thanks problem solved. But now this brings up another question.
>
> Private Sub Command11_Click()
>
> refind = BookID
> Forms!frmBooks!frmBookAuthor!Authors.Requery
> Forms!frmBooks.Requery
> DoCmd.GoToRecord , "frmBooks", , refind
>
> End Sub
>
> With the above code why does it go to the record after the one stored in
> refind?



It doesn't look to me like you are using the GoToRecord method correctly.
Check the help file entry for that method. Your code is telling it the
current form -- whatever it is -- to advance (refind) records. Is that what
you had in mind? If BookID is the primary key of the current record, and
you want to requery the current form and then return to that record, then
your code might look like this:

refind = Me.BookID
Me.Requery
Me.Recordset.FindFirst "BookID=" & refind

That's assuming that BookID is a numeric field.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Requery Form data Tara Microsoft Access Form Coding 5 27th Aug 2008 04:39 PM
requery on timer? does this make sense? JK Microsoft Access 0 14th Feb 2008 02:22 PM
Requery data in a form =?Utf-8?B?VEVTQTBfNA==?= Microsoft Access Getting Started 4 13th Sep 2006 02:42 PM
Requery data =?Utf-8?B?U2ltb24=?= Microsoft Access 15 27th Apr 2006 07:43 PM
requery cbo and make value equal to cur frm value Angi Microsoft Access Form Coding 6 13th Mar 2005 03:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:55 PM.