A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Filter Form based on OnClick from Text Box of another form



 
 
Thread Tools Display Modes
  #1  
Old May 20th, 2010, 03:01 PM posted to microsoft.public.access.tablesdbdesign
Phil H
external usenet poster
 
Posts: 15
Default Filter Form based on OnClick from Text Box of another form

Hi,
I have a job list form with basic info on it. I want to be able to click on
the job number text box which then opens up a more detailed form and applies
a filter so that I only get the record for the job number that I have clicked
on from the underlaying form.

Could someone please tell me how to do this as I am guessing it should be
fairly simple although I can't figure it out.

Thanks in advance
  #2  
Old May 21st, 2010, 04:47 AM posted to microsoft.public.access.tablesdbdesign
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Filter Form based on OnClick from Text Box of another form

Dim strWhere As String
strWhere = "[JobNumber] = " & Me.[JobNumber]
Debug.Print strWhere 'for testing only
DoCmd.OpenForm "NameOfForm", , , strWhere


Note:
If the job number field is a number data type, the code above will work.
If the job number field is a text data type, use this instead:
strWhere = "[JobNumber] = """ & Me.[JobNumber] & """"
Replace [JobNumber] with the name of the job number field

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Phil H" wrote in message
...
Hi,
I have a job list form with basic info on it. I want to be able to click
on
the job number text box which then opens up a more detailed form and
applies
a filter so that I only get the record for the job number that I have
clicked
on from the underlaying form.

Could someone please tell me how to do this as I am guessing it should be
fairly simple although I can't figure it out.

Thanks in advance



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:22 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.