By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,376 Members | 3,024 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,376 IT Pros & Developers. It's quick & easy.

filter form using the previous focus

100+
P: 222
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
Share this Question
Share on Google+
5 Replies


nico5038
Expert 2.5K+
P: 3,072
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

100+
P: 222
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
Expert 2.5K+
P: 3,072
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

100+
P: 222
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
Expert 2.5K+
P: 3,072
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

Post your reply

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