Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 17th, 2004, 03:02 AM
Registered User
 
Join Date: Sep 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Generate userform' s variables names

Hi,

I usually use userforms to view/create database in excel. The problem is when the number of column is high, I have to enter and link all variables of the userform to excel cells. I am sure there is a way to write the code in one line. My code look like this

Private Sub Userform_Initialize()



Set rgdata = ActiveCell.EntireRow

gotorgdata = rgdata.Value

DealField1.Value = gotorgdata(1, 1)
DealField2.Value = gotorgdata(1, 2)
DealField3.Value = gotorgdata(1, 3)
DealField4.Value = gotorgdata(1, 4)
DealField5.Value = gotorgdata(1, 5)
DealField6.Value = gotorgdata(1, 6)
DealField7.Value = gotorgdata(1, 7)
DealField8.Value = gotorgdata(1, 8)
DealField9.Value = gotorgdata(1, 9)
DealField10.Value = gotorgdata(1, 10)
DealField11.Value = gotorgdata(1, 11)
DealField12.Value = gotorgdata(1, 12)
DealField13.Value = gotorgdata(1, 13)
DealField14.Value = gotorgdata(1, 14)
DealField15.Value = gotorgdata(1, 15)
DealField16.Value = gotorgdata(1, 16)
DealField17.Value = gotorgdata(1, 17)
DealField18.Value = gotorgdata(1, 18)
DealField19.Value = gotorgdata(1, 19)
DealField20.Value = gotorgdata(1, 20)

End sub

Also if there is a way to create names for all the text boxes of the userform it will be easier.

Can you help me out?

Thank you very much

Joe






Similar Threads
Thread Thread Starter Forum Replies Last Post
generate variable names dinamycally gcorcuera Classic ASP Basics 7 May 21st, 2007 09:53 AM
UserType Variables--loop thru their names? Paul Gerken VB How-To 10 December 4th, 2006 01:08 PM
How to create auto generate variables? yikchin JSP Basics 1 December 19th, 2005 07:27 AM
Assembling Variables' names in the code? Pericles PHP How-To 1 September 22nd, 2005 09:24 AM
Database names as variables bukky Classic ASP Databases 0 March 15th, 2004 04:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.