Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find First Error!!! Help!!!

Status
Not open for further replies.

ptiernan

IS-IT--Management
Apr 29, 2003
55
GB
Hi All, I have a problem I hope someone can help me with.

I have open a recordset of another table as below.

Dim rs1 AS DAO.Recordset

set rs1 = CurrentDb.OpenRecordset("SELECT * FROM AT_MI")

This table AT_MI has a field named NINO and I want to check for a duplicate.

Within the current form I have a a text box named ATfJ_NI that I want to check is in the AT_MI table within the NINO field so I do the following.


rs1.MoveLast
rs1.MoveFirst
str1 = "[NINO]=" Me![ATfJ_NI]
rs1.FindFirst str1
If rs1.NoMatch then
'Do some work'

When I test this it returns an error on the contents of the text box ATfj_NI "Does not recognize 'NW857395' as a valid field name or expression.

Can anyone help please?

Much Thanks
Paul Tiernan

 
Dim rs1 AS DAO.Recordset

set rs1 = CurrentDb.OpenRecordset("SELECT * FROM AT_MI WHERE NINO = '" & Me![ATfJ_NI] & "'")

Then just check if any rows returned.



Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top