Vb Input Box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dwadish
    New Member
    • Nov 2006
    • 129

    #1

    Vb Input Box

    Hai guys i am razak and am a beginer to vb

    Thus i am creating a digital dairy for storing and daily activities of me and every one who want to..> and i am totaly confused with the input box because it is working and accessing the codes clearly but in another form in the same project it is not working with the same code.

    using the access 2003 as a back end. just see my code
    button_click()
    dim s as string
    "the code field is text"
    s=inputbox("ent er your code","dairy.co m")
    if s<> "" then
    recordset.findf irst "code=" & s
    form.show
    else
    msgbox "invalid code"
    endif
    end sub
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    Originally posted by dwadish
    Hai guys i am razak and am a beginer to vb

    Thus i am creating a digital dairy for storing and daily activities of me and every one who want to..> and i am totaly confused with the input box because it is working and accessing the codes clearly but in another form in the same project it is not working with the same code.

    using the access 2003 as a back end. just see my code
    Code:
    button_click()
    dim s as string 
    [B]"the code field is text"[/B]
    s=inputbox("enter your code","dairy.com")
    if s<> "" then
      recordset.findfirst "code=" & s
      form.show
    else
      msgbox "invalid code"
    endif
    end sub
    The line I have highlighted certainly does not look like valid VB code. Also, if the code field is text as indicated, then you need to put single quote delimiters around the value. In other words...
    Code:
    recordset.findfirst "code=[B]'[/B]" & s & "[B]'[/B]"
    Um... at least, I think so. Certainly when building an SQL string for a query, you need the quotes. Not absolutely certain about in the FindFirst, though.

    Oh, by the way - I'm almost certain that you mean "diary" and not "dairy". :) There's a difference.

    Comment

    • dwadish
      New Member
      • Nov 2006
      • 129

      #3
      Originally posted by Killer42
      The line I have highlighted certainly does not look like valid VB code. Also, if the code field is text as indicated, then you need to put single quote delimiters around the value. In other words...
      Code:
      recordset.findfirst "code=[B]'[/B]" & s & "[B]'[/B]"
      Um... at least, I think so. Certainly when building an SQL string for a query, you need the quotes. Not absolutely certain about in the FindFirst, though.

      Oh, by the way - I'm almost certain that you mean "diary" and not "dairy". :) There's a difference.
      Thanx killer42 for u'r kind inform. but i can move with this code

      rs.findfirst "code=" & s

      but access only the numeric value

      thanx really..

      Comment

      Working...