Group:  Microsoft Access » microsoft.public.access.formscoding
Thread: requery lookup information

Geek News

requery lookup information
Angi <angiw[ at ]aol.com> 12/2/2008 3:00:24 PM
I have a lookup form that displays information based on what is
selected from an unbound combo box (cboLU).

I've added a cmd button (cmdRemove) to the bottom of the form to
delete (make inactive) the current record. It takes the name out of
cboLU, but it doesn't requery the main information. I end up with a
blank in the combo box, but the form stays filled in.

My current code is:

Me.Inactive = True
Me.Dirty = False
Me.cboLU.Requery
Me.Requery

My form source is:
SELECT tblStudent.*, tblStudent.SdtID FROM tblStudent WHERE
(((tblStudent.SdtID)=[Forms]![frmStudentLU]![cboLU]));

I've tried using Me.SdtID.Requery, but that didn't work either. Any
help would be appreciated. TIA
Re: requery lookup information
"Dirk Goldgar" <dg[ at ]NOdataSPAMgnostics.com.invalid> 12/2/2008 3:14:44 PM
"Angi" <angiw[ at ]aol.com> wrote in message
news:6bf5fca9-57c5-4d46-9d67-2809b76f2aa8[ at ]e18g2000yqo.googlegroups.com...
[Quoted Text]
>I have a lookup form that displays information based on what is
> selected from an unbound combo box (cboLU).
>
> I've added a cmd button (cmdRemove) to the bottom of the form to
> delete (make inactive) the current record. It takes the name out of
> cboLU, but it doesn't requery the main information. I end up with a
> blank in the combo box, but the form stays filled in.
>
> My current code is:
>
> Me.Inactive = True
> Me.Dirty = False
> Me.cboLU.Requery
> Me.Requery
>
> My form source is:
> SELECT tblStudent.*, tblStudent.SdtID FROM tblStudent WHERE
> (((tblStudent.SdtID)=[Forms]![frmStudentLU]![cboLU]));
>
> I've tried using Me.SdtID.Requery, but that didn't work either. Any
> help would be appreciated. TIA


I assum the rowsource of cboLU excludes inactive records? I think that you
have requeried cboLU but not cleared its value (which, since it is no longer
in the rowsource, doesn't display). Add the line:

Me.cboLU = Null

before you requery the form.

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

(please reply to the newsgroup)

Re: requery lookup information
Angi <angiw[ at ]aol.com> 12/2/2008 3:23:13 PM
On Dec 2, 10:14 am, "Dirk Goldgar"
<d...[ at ]NOdataSPAMgnostics.com.invalid> wrote:
[Quoted Text]
> "Angi" <an...[ at ]aol.com> wrote in message
>
> news:6bf5fca9-57c5-4d46-9d67-2809b76f2aa8[ at ]e18g2000yqo.googlegroups.com...
>
>
>
>
>
> >I have a lookup form that displays information based on what is
> > selected from an unbound combo box (cboLU).
>
> > I've added a cmd button (cmdRemove) to the bottom of the form to
> > delete (make inactive) the current record.  It takes the name out of
> > cboLU, but it doesn't requery the main information.  I end up with a
> > blank in the combo box, but the form stays filled in.
>
> > My current code is:
>
> >    Me.Inactive = True
> >    Me.Dirty = False
> >    Me.cboLU.Requery
> >    Me.Requery
>
> > My form source is:
> > SELECT tblStudent.*, tblStudent.SdtID FROM tblStudent WHERE
> > (((tblStudent.SdtID)=[Forms]![frmStudentLU]![cboLU]));
>
> > I've tried using Me.SdtID.Requery, but that didn't work either.  Any
> > help would be appreciated.  TIA
>
> I assum the rowsource of cboLU excludes inactive records?  I think that you
> have requeried cboLU but not cleared its value (which, since it is no longer
> in the rowsource, doesn't display).  Add the line:
>
>     Me.cboLU = Null
>
> before you requery the form.
>
> --
> Dirk Goldgar, MS Access MVPwww.datagnostics.com
>
> (please reply to the newsgroup)- Hide quoted text -
>
> - Show quoted text -

That was it. Thank you!

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net