Re: continous form to find record



Dim rst As Recordset

Set rst = CurrentDb.OpenRecordset("tblStudent")
rst.FindFirst "[SSN] = '" & Me.txtSSN & "'"
If rst.NoMatch Then
MsgBox "SSN " & Me.txtSSN & " Is not in tblStudent"
Else
Me.txtStudentSSN = rst![SSN]
Me.txtStudentLast = rst![Last]
Me.txtStudentFirst = rst![First]
Me.txtStudentM = rst![M]
End If
set rst = Nothing

Change the names to suit
Garnish with fresh fruit and mint leaves
Sprinkle with powdered sugar
:)


"Song" wrote:

Great! Since I'm new, can you provide code for recordset and find ssn?
thanks.

"Klatuu" <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7EFB4439-715A-4F30-B564-90970E1BED16@xxxxxxxxxxxxxxxx
Yes, you could create a recordset and load the fields it into unbound
controls.

"Song" wrote:

Thanks. However, the relationship I set up is 'intermediate' type and
would
not allow me to data entry into tblException. I cannot modify tblStudent
structure as it resides in network.

Is there a way to find record in tblStudent without setup relationship?

I just want to enter SSN in tblException and some kind of code to find
record in tblStudent, get Last, First, M fields value and display on my
form?

thanks.


"Klatuu" <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1D8A07D3-ADCC-4C3C-B47F-E835EF32D9C3@xxxxxxxxxxxxxxxx
Create a query to use as your recordset. It should join tblStudent to
tblException on SSN

"Song" wrote:

There are multiple records in tblException. Each record is uniq (SSN)
I want to display Last, First, M of the first record found.
thanks.

"Klatuu" <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B6F92EAC-8F91-44B6-84E5-62BB216F662B@xxxxxxxxxxxxxxxx
This is a key question I need to know before I can suggest a way to
do
what
you want:
Are there multiple records in tblException for each Student or
Multiple
Students for each exception?

"Song" wrote:

tblException's SSN is Primary key without duplicate. This table is
in
my
C
drive.
tblStudent is table in the network for which I linked. I cannot
modify
that
table.
I have not set up relationship between these two.

"Klatuu" <Klatuu@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:6F0EE2EC-4C64-467D-85FE-AF54B72A2F2E@xxxxxxxxxxxxxxxx
What is the relationship between the tables? Are there multiple
records
in
tblException for each Student or Multiple Students for each
exception?

"Song" wrote:

I have 2 tables:

tblException tblStudent
SSN SSN
Last
First
M

tblStudent has many records and some records are duplicate

I want to set up a continous form to enter data into
tblException.
When
the
focus moves away from SSN field (BeforeUpdate event, I guess), I
want
Last,
First M of tblStudent to show next to it. If SSN entered cannot
be
found
in
tblStudent, a warning message should popup and update is
canceled.
How
to
code that? Thanks.















.



Relevant Pages

  • Re: continous form to find record
    ... "Song" wrote: ... Is there a way to find record in tblStudent without setup relationship? ... I just want to enter SSN in tblException and some kind of code to find ... Are there multiple records in tblException for each Student or Multiple ...
    (microsoft.public.access.forms)
  • Re: continous form to find record
    ... can you provide code for recordset and find ssn? ... "Song" wrote: ... Is there a way to find record in tblStudent without setup relationship? ... I just want to enter SSN in tblException and some kind of code to find ...
    (microsoft.public.access.forms)
  • Re: continous form to find record
    ... tblException on SSN ... "Song" wrote: ... Are there multiple records in tblException for each Student or Multiple ... tblStudent is table in the network for which I linked. ...
    (microsoft.public.access.forms)
  • Re: continous form to find record
    ... Is there a way to find record in tblStudent without setup relationship? ... I just want to enter SSN in tblException and some kind of code to find ... Are there multiple records in tblException for each Student or Multiple ...
    (microsoft.public.access.forms)