+ Reply to Thread
Results 1 to 5 of 5

Making Forms Perform

  1. #1
    Registered User
    Join Date
    06-11-2007
    Posts
    4

    Making Forms Perform

    Looping I think??

    --------------------------------------------------------------------------------

    Hi people thought I would drop a quick line before I go To lunch, I have designed a form which updates the fields in an excel database automatically,

    I have the following code: -

    PHP Code: 
    Set xlwbook xl.Workbooks.Open("C:\Documents and Settings\callcentre.temp02\My Documents\Copy of LeadsNCL.xls")
    Set xlsheet xlwbook.Sheets.Item(1)
    xlsheet.Cells(62) = TextBox1.Text
    xlsheet
    .Cells(63) = TextBox2.Text
    xlsheet
    .Cells(64) = ComboBox1.Text
    xlsheet
    .Cells(65) = TextBox3.Text
    xlsheet
    .Cells(66) = TextBox4.Text
    xlsheet
    .Cells(67) = TextBox5.Text
    xlsheet
    .Cells(68) = TextBox6.Text
    xlsheet
    .Cells(69) = TextBox7.Text
    xlsheet
    .Cells(610) = ComboBox2.Text
    xlsheet
    .Cells(611) = TextBox8.Text
    xlsheet
    .Cells(612) = TextBox9.Text
    xlsheet
    .Cells(613) = TextBox10.Text
    xlsheet
    .Cells(614) = TextBox11.Text
    xlsheet
    .Cells(615) = TextBox12.Text
    xlsheet
    .Cells(616) = TextBox13.Text
    xlsheet
    .Cells(617) = TextBox14.Text
    xlsheet
    .Cells(618) = ComboBox3.Text
    xlsheet
    .Cells(619) = TextBox15.Text
    xlsheet
    .Cells(620) = TextBox16.Text
    xlsheet
    .Cells(621) = ComboBox4.Text
    xlsheet
    .Cells(622) = ComboBox5.Text
    xlwbook
    .Save 
    The (6) relates to the row, when i add a new record all data is currently entered into the same cell and replaces the previous data. I need the 6 to become 7 and so on everytime the form is re completed.

    I hope you understand what I am trying to say,

    If anyone can help me out with this it will be very much appreciated.

    Kind Regards

    Jimmy

  2. #2
    Registered User
    Join Date
    05-15-2007
    Posts
    4
    How many rows do you want this executed for?

  3. #3
    Registered User
    Join Date
    06-16-2007
    Location
    Texas
    Posts
    1
    jimmyquinn,

    Not exactly sure if this is what you meant, but this may be something that will help you. This assumes you have a non-blank set of data in the second column...otherwise it will just find the first blank...and assuming your dataset starts in the first row...if not just change to match your data.

    Please Login or Register  to view this content.
    Hope it helps

    Doug

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    This gets the next vacant row and adds your data to that row

    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    This will loop through all TextBoxes on the Form, writing the data to the next empty row. Presumably you have declared all your other variables

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1