Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA code to retrieve an array

Status
Not open for further replies.

KentMorand

Technical User
Feb 27, 2002
32
US
Hey all I need to return multiple fields to populate controls on a form and am not sure what the code should look like. The form is used to enter new records and with someone's help :) it will also fill these fields with info retrieved from a table. I was thinking of running an SQL statement on the click of a button that will put all the neccessary info into an array and then assign each field the appropiate value from the array. I'm totally unsure what the code would look like though. Any help at all would be greatly appreciated. Thanks in advance.
 
Sounds like you are creating too much work for yourself....

You want a form that you can use to enter new records. Create the form with controls BOUND to the table you wish the data to be stored in. Set the forms "DataEntry" property to Yes, and the form will always open to the "new" record, or all fields blank, so you can enter new records...

No need for the array/update you are trying to create...

****************************
Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former. (Albert Einstein)

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
Thanks for responding Robert. That's basically how it is set up. All the fields are bound. The thing is this form has a ton or records in it and I want to be able to return a specific record for a specific individual for a specific month. I figured I could run the SQL to save time scrolling through records to find the one I want. In other words choose a month and an individual and hit a button that will populate the fields on this form. I would certainly be open to an easier way around this. Thanks again for your help. :)
 
Then what you actually want is a "search" ability on the form.....basically two combo boxes, one for person and one for month. You select each one, then click the search button. The form then jumps focus to that particular person for that month...

Sound right???

not too tough once you know the process....

****************************
Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former. (Albert Einstein)

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
Yes that would be it exactly. Could you maybe add some detail as to how I could achieve that? I'm sorry if this is something easy to do... I haven't used access in a while and am very rusty. Thanks again Robert you are a great help.
 
sure....if you want to shoot me an email to my work address I'll send an example.

****************************
Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former. (Albert Einstein)

Robert L. Johnson III
MCSA, CNA, Net+, A+
w: rljohnso@stewart.com
h: wildmage@tampabay.rr.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top