PC Review


Reply
Thread Tools Rate Thread

Compare fields from different sources?

 
 
PROskid TechInfo
Guest
Posts: n/a
 
      23rd Jun 2006
Hi All.

I have a form which contains a subform.

I was thinking of using the "On Exit" event in one of the subform fields to
trigger the following:

1. Take the value the user has just entered into the sform field with the on
Exit event attached
2. See if that value exists in a field of a particular table (the table name
would be included in the code)
3. If the value does exist display another form showing fields from the
table (based on a select query where the value the user entered is the WHERE
part)
4. If the value does not exist in the checked table - continue working
normally.



ie. Dim myValue As String

myValue = Forms!sfmMyForm.[egField] 'How do I narrow this down to the
current row?

If myValue exists in Tables!tblTest.[testField] Then
DoCmd.OpenForm "myOtherForm" ' Open the form based on the select
query containing the myValue in the WHERE part
Else
End
End If


Thanks in advance for any help provided.


 
Reply With Quote
 
 
 
 
Steve Schapel
Guest
Posts: n/a
 
      23rd Jun 2006
PROskid,

I would use the After Update event rather than the Exit event.

Dim strCrit As String
strCrit = "[egField]='" & Me.TestField & "'"
If DCount("*","tblTest",strCrit) > 0 Then
DoCmd.OpenForm "MyOtherForm", , , strCrit
End If

--
Steve Schapel, Microsoft Access MVP

PROskid TechInfo wrote:
> Hi All.
>
> I have a form which contains a subform.
>
> I was thinking of using the "On Exit" event in one of the subform fields to
> trigger the following:
>
> 1. Take the value the user has just entered into the sform field with the on
> Exit event attached
> 2. See if that value exists in a field of a particular table (the table name
> would be included in the code)
> 3. If the value does exist display another form showing fields from the
> table (based on a select query where the value the user entered is the WHERE
> part)
> 4. If the value does not exist in the checked table - continue working
> normally.
>
>
>
> ie. Dim myValue As String
>
> myValue = Forms!sfmMyForm.[egField] 'How do I narrow this down to the
> current row?
>
> If myValue exists in Tables!tblTest.[testField] Then
> DoCmd.OpenForm "myOtherForm" ' Open the form based on the select
> query containing the myValue in the WHERE part
> Else
> End
> End If
>
>
> Thanks in advance for any help provided.
>
>

 
Reply With Quote
 
JamesW
Guest
Posts: n/a
 
      24th Jun 2006
Thanks for the help.

I'll give it a go....




 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need fields to show info from different sources Pamela Microsoft Access Form Coding 0 25th Jan 2009 12:47 AM
Clearing Fields - Inconvenient Control Sources =?Utf-8?B?VGF0YWthdQ==?= Microsoft Access Form Coding 1 11th Oct 2005 02:11 PM
Trying to compare data from 2 different sources borkot01 Microsoft Excel Misc 2 3rd Aug 2005 08:55 PM
How do i link sources with more than 255 fields? =?Utf-8?B?TWV4YW05MTk1MA==?= Microsoft Access External Data 2 20th Jan 2005 07:40 PM
How do i link sources with more than 255 fields? =?Utf-8?B?UmF1bA==?= Microsoft Access External Data 0 20th Jan 2005 04:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:36 PM.