Form / VB Solution HELP Urgent

Form / VB Solution HELP Urgent

Post by Mark Dutto » Wed, 29 Sep 1999 04:00:00



Hello All,
                I need some help with a little VB code for an access 97
database.
It should be easy but I can't figure it out.  Ok the problem is
I have a sub form in a form, the sub forms first field takes a
ProjectId, the second field needs to use a query or filter to return all
the jobs with that ProjectId and list them in a combo box..
I have all the tables and relations correct and the query to get all
jobs.  However I need to have a query that runs each time a new
ProjectId is Entered and only returns the jobs for that projectID.  The
sub form is a data sheet view.

Thanks & Regards in Advance
Philip Dutton

 
 
 

Form / VB Solution HELP Urgent

Post by Chris Nebinge » Wed, 29 Sep 1999 04:00:00


On the AfterUpdate event for ProjectID:
cboField2.Requery

--
HTH

Chris Nebinger

Quote:> Hello All,
>                 I need some help with a little VB code for an access 97
> database.
> It should be easy but I can't figure it out.  Ok the problem is
> I have a sub form in a form, the sub forms first field takes a
> ProjectId, the second field needs to use a query or filter to return all
> the jobs with that ProjectId and list them in a combo box..
> I have all the tables and relations correct and the query to get all
> jobs.  However I need to have a query that runs each time a new
> ProjectId is Entered and only returns the jobs for that projectID.  The
> sub form is a data sheet view.

> Thanks & Regards in Advance
> Philip Dutton


 
 
 

Form / VB Solution HELP Urgent

Post by Efrain Plaz » Wed, 29 Sep 1999 04:00:00


Hey Mark:

What I did in this case was to double click the field thet gets the proyect
info and in the event tab choose On change, insert an Event Procedure.
Inside it put:

Private Sub test_Change()
Query1.Requery
End Sub

Where test is your first field ans Query1 is the query you are using to get
the jobs, this will refresh your data

Best regards,

Tony Plaza

Systems Engineer
Compro Systems, INC
Durham, NC


Quote:> Hello All,
>                 I need some help with a little VB code for an access 97
> database.
> It should be easy but I can't figure it out.  Ok the problem is
> I have a sub form in a form, the sub forms first field takes a
> ProjectId, the second field needs to use a query or filter to return all
> the jobs with that ProjectId and list them in a combo box..
> I have all the tables and relations correct and the query to get all
> jobs.  However I need to have a query that runs each time a new
> ProjectId is Entered and only returns the jobs for that projectID.  The
> sub form is a data sheet view.

> Thanks & Regards in Advance
> Philip Dutton

 
 
 

Form / VB Solution HELP Urgent

Post by algo » Wed, 29 Sep 1999 04:00:00


On Tue, 28 Sep 1999 14:18:17 +1000, Mark Dutton


>Hello All,
>                I need some help with a little VB code for an access 97
>database.
>It should be easy but I can't figure it out.  Ok the problem is
>I have a sub form in a form, the sub forms first field takes a
>ProjectId, the second field needs to use a query or filter to return all
>the jobs with that ProjectId and list them in a combo box..
>I have all the tables and relations correct and the query to get all
>jobs.  However I need to have a query that runs each time a new
>ProjectId is Entered and only returns the jobs for that projectID.  The
>sub form is a data sheet view.

>Thanks & Regards in Advance
>Philip Dutton

Set the criteria for the Query projectID to = that on the form. Use
the expression builder to get the syntax if you aren't sure.
Requery your combo box after you enter the new project ID. Maybe on
the lost focus event of the ID field
 --

 Alan Goss

 Paranoia is natures way of telling you to 'be careful out there'

 
 
 

Form / VB Solution HELP Urgent

Post by Dutton' » Thu, 30 Sep 1999 04:00:00


Hey Algoss,
                    Thanks for your help,  I have another problem which is
really stumping me.  The Subject is Funky VB/Access Problem.  There must be a
solution but no one yet has worked it out.
Hope you can help.

Regards
Philip Dutton


> On Tue, 28 Sep 1999 14:18:17 +1000, Mark Dutton

> >Hello All,
> >                I need some help with a little VB code for an access 97
> >database.
> >It should be easy but I can't figure it out.  Ok the problem is
> >I have a sub form in a form, the sub forms first field takes a
> >ProjectId, the second field needs to use a query or filter to return all
> >the jobs with that ProjectId and list them in a combo box..
> >I have all the tables and relations correct and the query to get all
> >jobs.  However I need to have a query that runs each time a new
> >ProjectId is Entered and only returns the jobs for that projectID.  The
> >sub form is a data sheet view.

> >Thanks & Regards in Advance
> >Philip Dutton

> Set the criteria for the Query projectID to = that on the form. Use
> the expression builder to get the syntax if you aren't sure.
> Requery your combo box after you enter the new project ID. Maybe on
> the lost focus event of the ID field
>  --

>  Alan Goss

>  Paranoia is natures way of telling you to 'be careful out there'

 
 
 

Form / VB Solution HELP Urgent

Post by Dutton' » Thu, 30 Sep 1999 04:00:00


Hey Efrain,
                    Thanks for your help with the requery stuff.  I have
another problem,
thought you might be able to help.  The Subject is Funky VB/Access Problem.

Any help would be appreciated.

Regards
Philip Dutton


> Hey Mark:

> What I did in this case was to double click the field thet gets the proyect
> info and in the event tab choose On change, insert an Event Procedure.
> Inside it put:

> Private Sub test_Change()
> Query1.Requery
> End Sub

> Where test is your first field ans Query1 is the query you are using to get
> the jobs, this will refresh your data

> Best regards,

> Tony Plaza

> Systems Engineer
> Compro Systems, INC
> Durham, NC



> > Hello All,
> >                 I need some help with a little VB code for an access 97
> > database.
> > It should be easy but I can't figure it out.  Ok the problem is
> > I have a sub form in a form, the sub forms first field takes a
> > ProjectId, the second field needs to use a query or filter to return all
> > the jobs with that ProjectId and list them in a combo box..
> > I have all the tables and relations correct and the query to get all
> > jobs.  However I need to have a query that runs each time a new
> > ProjectId is Entered and only returns the jobs for that projectID.  The
> > sub form is a data sheet view.

> > Thanks & Regards in Advance
> > Philip Dutton