473,508 Members | 2,079 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 1792
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
6454
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...
2
18727
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...
15
4643
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...
4
2068
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...
1
2042
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...
5
17676
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...
4
2310
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,...
4
6020
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...
5
2234
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...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7328
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,...
0
7388
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...
1
7049
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...
0
7499
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...
0
5631
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,...
0
3199
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...
0
3186
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
422
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...

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.