Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

HELP! Coding problem with Search Button

Discussion in 'Information Technology' started by Phil, Nov 11, 2005.

  1. Phil

    Phil
    Expand Collapse
    Guest

    I have built a database and am trying to add a search facility to one of the
    forms. I have a form called 'Safe-Point Units & Customers' which contains
    several fields. One of these fields is named 'Serial Number (SP100-)'. I wish
    to add a search button to my form so i can search for a specific serial
    number. This number is 6 digits long (i.e.030014).

    So far i have built my button and am now trying to add the relevant code to
    make it do what i want upon 'OnClick'. I have tried copying code etc from the
    Access Help pages but i just can't seem to get it to work. This is my code so
    far:

    <SCRIPT language=vbscript event=onclick for=command0>
    <!--
    ' Clone the recordset.
    Dim rs
    Set rs = MSODSC.DataPages(0).Recordset.Clone
    On error resume next
    -->
    rs.find "Safe-Point Serial Numer (SP100-) '%" & CStr(inputbox("Enter a
    Serial Number","Find"))
    &"%'"
    ' Custom error handling.
    If (err.number <> 0) Then
    Msgbox "Error: " & err.number & " " & err.description,,"Invalid Search"
    Exit Sub
    End If
    ' Check search results for success.
    If (rs.bof) or (rs.eof) Then
    Msgbox "Serial Number Not Found",,"Search Done"
    Exit Sub
    End If
    MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
    -->
    </SCRIPT>

    When i keep trying the button it gives me a runtime error and starts
    highlighting parts of the code which are obviously not correct. I'm new to
    coding etc and would much appreciate your help in trying to resolve this
    matter. At present i havn't a clue what to dobut i'm sure this is a pretty
    easy thing for some of you out there.

    Many thanks in advance.

    Phil
     
  2. Loading...


Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page