473,666 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

filter form using the previous focus

222 New Member
Hello sirs;


I do have a continuous form on MS access 2003 I would like to filter this form using the content of the field. I am using this code.
Expand|Select|Wrap|Line Numbers
  1. Dim y, x As String
  2. y = Application.Screen.PreviousControl.Name
  3.  
  4.     x = Application.Screen.PreviousControl.Value
  5.  
  6. Me.Filter = "[y]= " & [x] & " "
  7. Me.FilterOn = True
I think access is not understanding the Y.

Any suggestion or help.

Best regards;


WASSIM S DACCACHE
May 10 '08 #1
5 1802
nico5038
3,080 Recognized Expert Specialist
When your control holds the name of a valid field, use:
Me.Filter = y & "=" & x
when it's a numeric value, or for text:
Me.Filter = y & "='" & x & "'"

Getting the idea ?

Nic;o)
May 10 '08 #2
wassimdaccache
222 New Member
Yeah it works thank you .


How can I know the field type if string ,number or boolean


Any suggestions would be helpful.



THANK YOU


wassim s daccache
May 11 '08 #3
nico5038
3,080 Recognized Expert Specialist
You'll have to look that up in the table definition. Just open the table the field is located in design mode.

Nic;o)
May 11 '08 #4
wassimdaccache
222 New Member
Yes I know this method but actually what i am looking for is to have a code that reply for me the field type in my form so it will be easy to implement my code by just assigning 1 button to all fields used in my form.(my table contains 55 fields)

Best regards;


WASSIM S DACCACHE
May 11 '08 #5
nico5038
3,080 Recognized Expert Specialist
You'll need the Field property Type to determine this. From the helpfile:

For a Field object, the possible settings and return values are described in the following table.
Constant Description
dbBigInt Big Integer
dbBinary Binary
dbBoolean Boolean
dbByte Byte
dbChar Char
dbCurrency Currency
dbDate Date/Time
dbDecimal Decimal
dbDouble Double
dbFloat Float
dbGUID GUID
dbInteger Integer
dbLong Long
dbLongBinary Long Binary (OLE Object)
dbMemo Memo
dbNumeric Numeric
dbSingle Single
dbText Text
dbTime Time
dbTimeStamp Time Stamp
dbVarBinary VarBinary

Nic;o)
May 11 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

0
6468
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the report are based on the same View addressed in the Record Source of both as 'dbo.CLMain_vw'. The View resides in a SQL Server 2000 database. There are two different problems I am having with filtering: The first involves filtering in the form by date...
2
18739
by: Brian Newman | last post by:
I've got what is actually a triple-layer nested form. That part works fine. I've got the first subform related by the right key field to the main form, then I've got the second subform related to the first subform by their shared key field. Browsing in that arrangement works beautifully. Now, the third tier is the line item data, and there are a number of different kinds of line items sharing the same table -- specifically, there...
15
4653
by: Steve | last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I have code that sets the default value of each field to its current value. For a new record, I can put the focus in any field to start. If I edit that field and then click on the new record button in the navigation buttons, the form goes to a new record and each field has the default value of the previous record. If I put the focus in any field to start, edit that...
4
2076
by: Dave Griffiths | last post by:
In an Access 97 application I have changed a form from a 'normal' form with custom toolbar, menubar and shortcut bar to a model popup form. The shortcut menu has Filter by Form on it and used to work fine, but since changing the form type it is now disabled. Any ideas why please Dave
1
2053
by: Keith | last post by:
A2003, Xp Pro. I've designed a form which contains 6 of combos. Three on the left are set up to select fields from a query, three on the right are set up to select values from the corresponding field selected on the left. I use these combos to dynamically create a filter string to apply to my main form. It all works fine as long as I select text fields using quotation marks. My question is how do I handle different data types such...
5
17696
by: Navillus | last post by:
Hey gang, I have a login form that is empty by default, but can be filled with values from a previous form: <input type=text maxlength="40" size="40" name="user" value="`usr`"> <input type=password maxlength="8" name="password" value="`pss`"> where usr and pss are sent from the previous form.
4
2314
by: Michael R | last post by:
I'm using this code to filter a form: Me.Form.Filter = "Remarks Is Null" Me.Form.FilterOn = True What code can I use to filter without ruining the previous, already applied filter? Also, what is the correct syntax to filter using criteria from a control in VBA, for ex. from the control: ..? Thanks very much.
4
6046
by: Harlequin | last post by:
I have a question concerning the need to trigger events within a "child" subform which is itself enbedded within a master "parent" form and which is accessible via a tab in the parent form. Becuase this is all very difficult to explain in words, please bear with me as I endevour to explain what it is I am trying to do. It would be helpful if I could attach a graphics file to this posting that would help explain what it is I'm trying to achieve...
5
2252
by: MC | last post by:
Hi, I have been looking around for a way to apply the filter that grays out a form or div. I found some examples but the code is pretty complex. Any simple ways to gray that out so I can highlight another form or div? Thanks, Mica PS. I looked at several of the 'easy' examples and they did not work when I applied them.
0
8444
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8869
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7386
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1775
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.