PC Review


Reply
Thread Tools Rate Thread

Access - calling a form and applying a filter

 
 
=?Utf-8?B?VG9tIFdpbGR5?=
Guest
Posts: n/a
 
      23rd Jan 2006
I have a form that selects a project, financial year and repoarting qurter
and then opens a form showing a project and its outputs. I can't get the
form to pick up the project from the first form.

Do I create variables and pass themn as in conventional programing, or what?

YOurs

Tom
 
Reply With Quote
 
 
 
 
=?Utf-8?B?eFJvYWNoeA==?=
Guest
Posts: n/a
 
      23rd Jan 2006
Based on your description, I'm guessing you have a combo of drop-downs and
text boxes on a lookup form and a command button. To do what you want to
accomplish, you need to use VBA code and it is not too difficult.

Below is a sub that is called when the command button, cmdOK, is clicked.
You can modify this code to fit your needs. If you need more specific help,
post back with your relevant code and questions.

Private Sub cmdOK_Click()

Dim strRep As String
Dim strTitle As String
Dim strFilter As String


'Populate the rep lookup
'
If IsNull(Me.cboRepList.Value) Then
strRep = "Like '*'"
Else
strRep = "=" & Me.cboRepList.Value
End If

'Populate the title lookup
'
If IsNull(Me.txtTitle.Value) Then
strTitle = "Like '*'"
Else
strTitle = "='" & Me.txtTitle.Value & "'"
End If


'Populate the where clause
'
strFilter = "[RepID] " & strRep & " AND [Title] " & strTitle

Debug.Print strFilter
DoCmd.OpenForm "REP_LIST_REF_F", acNormal, , strFilter, acFormEdit,
acWindowNormal
DoCmd.Close acForm, "REP_LOOKUP_F", acSaveNo

End Sub

"Tom Wildy" wrote:

> I have a form that selects a project, financial year and repoarting qurter
> and then opens a form showing a project and its outputs. I can't get the
> form to pick up the project from the first form.
>
> Do I create variables and pass themn as in conventional programing, or what?
>
> YOurs
>
> Tom

 
Reply With Quote
 
Van T. Dinh
Guest
Posts: n/a
 
      23rd Jan 2006
Check Access VB Help on the different arguments of the OpenForm method
(which you use to open the second Form), in particular, the "filter"
argument and the "wherecondition" argument.

--
HTH
Van T. Dinh
MVP (Access)



"Tom Wildy" <(E-Mail Removed)> wrote in message
news:C11BC141-87A8-4BBF-BA78-(E-Mail Removed)...
>I have a form that selects a project, financial year and repoarting qurter
> and then opens a form showing a project and its outputs. I can't get the
> form to pick up the project from the first form.
>
> Do I create variables and pass themn as in conventional programing, or
> what?
>
> YOurs
>
> Tom



 
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
Applying Form Filter By UserName =?Utf-8?B?U3ByaW5rcw==?= Microsoft Access Forms 3 20th Mar 2006 12:15 PM
Applying a filter to a form in access =?Utf-8?B?bWljaGFlbF9qYWNxdWVz?= Microsoft Access Forms 2 29th Jul 2005 02:05 PM
Saving and then Applying a filter on a form =?Utf-8?B?QnVubnlNb20=?= Microsoft Access Queries 2 24th Feb 2005 04:07 AM
Applying filter by form programatically =?Utf-8?B?TVNST09LSUU=?= Microsoft Access Form Coding 6 13th Feb 2005 02:15 AM
RE: Access 2000 ADP - error when applying form filter - error message =?Utf-8?B?Um9iZXJ0?= Microsoft Access Forms 0 26th Nov 2004 02:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:10 PM.