Results 1 to 3 of 3
  1. #1
    kpalar is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2014
    Posts
    9

    Question Find first

    Dear All

    I have created form to add record.

    In he first textbox I have created a lost focus as given below:

    Dim db
    Dim rs1
    Set db = CurrentDb
    Set rs1 = db.OpenRecordset("NEWITEM", 2)

    rs1.FindFirst "bcode=" & " ' " & Text0 & " ' "
    If rs1.NoMatch Then
    MsgBox "THIS IS A NEW ITEM CODE", vbInformation
    Else
    Text0 = rs1(0)
    Text2 = rs1(1)
    Text4 = rs1(2)
    Text6 = rs1(3)
    Text8 = rs1(4)
    Text10 = rs1(5)
    Text12 = rs1(6)
    Text14 = rs1(7)
    Text16 = rs1(8)


    MsgBox "THE ITEM CODE ALREADY EXISTS", vbCritical


    End if


    But it always gives the msg - THIS IS A NEW ITEM CODE


    Please help

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Perhaps you should set a breakpoint and look at your code as you step debug.

    It seems that you are not getting a match
    rs1.FindFirst "bcode=" & " ' " & Text0 & " ' "

    Perhaps you can asses the value of your Text0

  3. #3
    kpalar is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2014
    Posts
    9
    Thank You

    I have deleted he space("'")

Please reply to this thread with any new information or opinions.

Similar Threads

  1. To find out the first 2 max
    By murali in forum Access
    Replies: 1
    Last Post: 04-22-2014, 03:59 PM
  2. Find first won't find
    By lawdy in forum Programming
    Replies: 7
    Last Post: 12-15-2013, 02:00 PM
  3. Find
    By sergran in forum Programming
    Replies: 2
    Last Post: 10-08-2013, 01:02 AM
  4. I can't find the bug. Please help
    By sharVyn in forum Programming
    Replies: 5
    Last Post: 08-27-2012, 03:39 PM
  5. Find a SUM
    By jcsports31 in forum Access
    Replies: 8
    Last Post: 09-14-2010, 10:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums