Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / January 2008

Tip: Looking for answers? Try searching our database.

Filter records from combo box query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Julia - 04 Jan 2008 09:20 GMT
Hi,

I would like to add a function to a database so that:
* users click on a command button on one form
* a pop up window with a combo box appears to allow people to select a
project owner name.
*a second form opens with only the projects from that project owner.

But as a newbie I am finding it rather difficult.

Can you help me?

Thanks,
Julia
Jeanette Cunningham - 04 Jan 2008 09:49 GMT
Hi Julia,
the post doesn't say how much coding you have done with Access, so I am
guessing about how much code and explanations to put in here.
--for the click event of the cmd button put code something like this:
   DoCmd.OpenForm "frmOwner", , , , , acDialog

--this will open the form that has the combo for project owner and the main
form will wait until  a user closes frmOwner.
--instead of closing frmOwner you can just hide it so that you can get the
user's choice from the combo
--put a save button of frmOwner
--code its click event   me.visible = false
--now frmOwner will be open but invisible
--to get the user's choice put code something like this
--    with forms!frmOwner
           if len(.cboProjectOwner) >0 then
               strLinkCriteria = "[OwnerID] = " & .cboProjectOwner & ""
           else
           end if
   end with

so we have something like below:

Private cmdGetProjectOwner_Click()
Dim strLinkCriteria as string

   DoCmd.OpenForm "frmOwner", , , , , acDialog
   with forms!frmOwner
           if len(.cboProjectOwner) >0 then
               strLinkCriteria = "[OwnerID] = " & .cboProjectOwner & ""
           else
           end if
   end with
   docmd.close acform, "frmOwner"
   docmd.openform "frmProject", , ,  strLinkCriteria
   docmd.close acform, Me.name

End sub

** if OwnerID as a text field then use
   strLinkCriteria = "[OwnerID] = """ & cboProjectOwner & """"

frmOwner is the name of the form with the combo
frmProject is the form that opens with the projects from that project owner
OwnerID is the bound column of the combo

Jeanette Cunningham

> Hi,
>
[quoted text clipped - 10 lines]
> Thanks,
> Julia
Julia - 04 Jan 2008 10:18 GMT
Thanks Jeanette, I don't have much experience coding with Access, so I will
need some time to work out your answer and see if it does what I would like.
I will let you know how it goes.

> Hi Julia,
> the post doesn't say how much coding you have done with Access, so I am
[quoted text clipped - 58 lines]
> > Thanks,
> > Julia
Julia - 04 Jan 2008 16:31 GMT
Hi Jeanette,

I hope I don't depress you but I couldn't get your suggestion to work. I did
find a way to work around the problem by creating a form with only a combo
box that referred to the project owner's name. The I used the (oh no!) wizard
to make a button to open the other form and only show the records from that
project owner. It seems to work!

Julia

> Thanks Jeanette, I don't have much experience coding with Access, so I will
> need some time to work out your answer and see if it does what I would like.
[quoted text clipped - 62 lines]
> > > Thanks,
> > > Julia
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.