Data Capture with many Textboxes (VB and MS Access)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Baladin
    New Member
    • Feb 2008
    • 14

    Data Capture with many Textboxes (VB and MS Access)

    Hi

    I've got a form for Data Capture with loads of Text boxs with the same name, except with a different number at the end, oh and im using VB 2005

    i.e.

    txtName1 txtDOB1
    txtName2 txtDOB2
    ... ...

    I need to get all text boxes ending with "1" into a Row in my access database and all textboxes ending with "2" into another row, and so on...

    What I want to know is there a way to do this without having to write a line of code for each text box?

    Something like this (and i know this doesnt work):

    For NUM = 1 to 11
    tblUser.Row(ROW ).Item(1) = txtNameNUM
    Next
    Last edited by Baladin; Feb 12 '08, 02:58 PM. Reason: TO make it clear im using VB
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    i'll asume you're using a version of vb that does not support indexes, so, yes, use them as controls:

    [CODE=vb]dim Str1 as string
    for i = 1 to 10
    str1= str1 & form1.controls( "textbox" & i). text
    next[/CODE]

    will give you textbox1 to textbox10 into the string... well thats the main idea.
    HTH

    Comment

    • Baladin
      New Member
      • Feb 2008
      • 14

      #3
      cheers thats exactally what i need

      Comment

      • Baladin
        New Member
        • Feb 2008
        • 14

        #4
        it doesnt seem to work i get this error message:

        Comment

        • Baladin
          New Member
          • Feb 2008
          • 14

          #5
          It's alright I've worked it out,

          cheers that really helps, saves a lot of code writing

          Comment

          Working...