check whether that data is in the table

  • Follow


I want to check whether that data entered is in that table or not in MS
ACCESS...
I am using MS ACCESS to create my application....
May i know the way?

0
Reply EMILYTAN 4/13/2007 5:26:37 AM

Use DLookup() to see if the data is already in the table.

Details in:
    Getting a value from a table: DLookup()
at:
    http://allenbrowne.com/casu-07.html

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"EMILYTAN" <u33296@uwe> wrote in message
news:70a0683bf30a2@uwe...
>I want to check whether that data entered is in that table or not in MS
> ACCESS...
> I am using MS ACCESS to create my application....
> May i know the way?
>
0
Reply Allen 4/13/2007 5:35:55 AM


thanks...i will try on it...

Allen Browne wrote:
>Use DLookup() to see if the data is already in the table.
>
>Details in:
>    Getting a value from a table: DLookup()
>at:
>    http://allenbrowne.com/casu-07.html
>
>>I want to check whether that data entered is in that table or not in MS
>> ACCESS...
>> I am using MS ACCESS to create my application....
>> May i know the way?

0
Reply EMILYTAN 4/13/2007 7:00:41 AM

Hi Allen,
Can I know how to write the code when i click a button, it will auto check
whether that data is there, if there is, it will prompt a message "valid"
else "invalid".......?

Allen Browne wrote:
>Use DLookup() to see if the data is already in the table.
>
>Details in:
>    Getting a value from a table: DLookup()
>at:
>    http://allenbrowne.com/casu-07.html
>
>>I want to check whether that data entered is in that table or not in MS
>> ACCESS...
>> I am using MS ACCESS to create my application....
>> May i know the way?

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200704/1

0
Reply EMILYTAN 4/13/2007 7:56:36 AM

Yes: you can do that in the BeforeUpdate event procedure of your form.

We can't write your code for you, so if you don't know anything about 
writing code, you will have some learning to do to get there.

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"EMILYTAN via AccessMonster.com" <u33296@uwe> wrote in message
news:70a1b73d32cce@uwe...
> Hi Allen,
> Can I know how to write the code when i click a button, it will auto check
> whether that data is there, if there is, it will prompt a message "valid"
> else "invalid".......?
>
> Allen Browne wrote:
>>Use DLookup() to see if the data is already in the table.
>>
>>Details in:
>>    Getting a value from a table: DLookup()
>>at:
>>    http://allenbrowne.com/casu-07.html
>>
>>>I want to check whether that data entered is in that table or not in MS
>>> ACCESS...
>>> I am using MS ACCESS to create my application....
>>> May i know the way? 

0
Reply Allen 4/13/2007 1:50:57 PM

I wrote this code:-

             InRemarks.SetFocus
            Result = DLookup("[JobNumber]", "OpenJob", "[JobNumber] = " &
InRemarks.Text)
               MsgBox Result

I briefly explain how it flow. I will key in the job number in the InRemarks.
Text and when i click a button, it should be able to display the result that
has the record...
However, when i key in the job number it turn to be an error display data
type mismatch criteria expression and when i key in alpha numeric it display
you cancelled previous operations....
Why?

Allen Browne wrote:
>Yes: you can do that in the BeforeUpdate event procedure of your form.
>
>We can't write your code for you, so if you don't know anything about 
>writing code, you will have some learning to do to get there.
>
>> Hi Allen,
>> Can I know how to write the code when i click a button, it will auto check
>[quoted text clipped - 12 lines]
>>>> I am using MS ACCESS to create my application....
>>>> May i know the way?

-- 
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200704/1

0
Reply EMILYTAN 4/16/2007 7:31:31 AM

If you open the OpenJob table in design view, what data type is the 
JobNumber field?

If Text, try:
    Dim strWhere As String
    Dim varResult as Variant
    strWhere = "[JobNumber] = """ & Me.InRemarks & """"
    varResult = DLookup("[JobNumber]", "OpenJob", strWhere)
    MsgBox "Searched where " & strWhere & vbCrLf & _
        "Result: " & varResult

If the field is a Number type, change line 3 to:
    strWhere = "[JobNumber] = " & Nz(Me.InRemarks,0)

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"EMILYTAN via AccessMonster.com" <u33296@uwe> wrote in message
news:70c73745aa226@uwe...
>I wrote this code:-
>
>             InRemarks.SetFocus
>            Result = DLookup("[JobNumber]", "OpenJob", "[JobNumber] = " &
> InRemarks.Text)
>               MsgBox Result
>
> I briefly explain how it flow. I will key in the job number in the 
> InRemarks.
> Text and when i click a button, it should be able to display the result 
> that
> has the record...
> However, when i key in the job number it turn to be an error display data
> type mismatch criteria expression and when i key in alpha numeric it 
> display
> you cancelled previous operations....
> Why?
>
> Allen Browne wrote:
>>Yes: you can do that in the BeforeUpdate event procedure of your form.
>>
>>We can't write your code for you, so if you don't know anything about
>>writing code, you will have some learning to do to get there.
>>
>>> Hi Allen,
>>> Can I know how to write the code when i click a button, it will auto 
>>> check
>>[quoted text clipped - 12 lines]
>>>>> I am using MS ACCESS to create my application....
>>>>> May i know the way? 

0
Reply Allen 4/16/2007 9:58:22 AM

OH THANK YOU! It can work already! Thanks for helping!

Allen Browne wrote:
>If you open the OpenJob table in design view, what data type is the 
>JobNumber field?
>
>If Text, try:
>    Dim strWhere As String
>    Dim varResult as Variant
>    strWhere = "[JobNumber] = """ & Me.InRemarks & """"
>    varResult = DLookup("[JobNumber]", "OpenJob", strWhere)
>    MsgBox "Searched where " & strWhere & vbCrLf & _
>        "Result: " & varResult
>
>If the field is a Number type, change line 3 to:
>    strWhere = "[JobNumber] = " & Nz(Me.InRemarks,0)
>
>>I wrote this code:-
>>
>[quoted text clipped - 25 lines]
>>>>>> I am using MS ACCESS to create my application....
>>>>>> May i know the way?

-- 
Message posted via http://www.accessmonster.com

0
Reply EMILYTAN 4/17/2007 1:31:07 AM

7 Replies
131 Views

(page loaded in 0.189 seconds)

Similiar Articles:
















7/26/2012 9:33:13 PM


Reply: