Use global variables to fill form after Adodc AddNew call

Posted on 2006-10-23
Last Modified: 2010-04-30
     Application with two forms.  Main Data and Assistance Data. Main data only has one entry for each applicant. Assistance can have any number of entrys of each applicant in the Main Data. When I get a request from a applicant I check my main data to verify they are in data base or I enter their SSN and data at that time. I want to be able to save the data such as first and last names, address etc as global variables when selected in main form. I then call the Assistance form and issue a AddNew call. Form of course clears as it should but I haven't figured away to make it take the global variables to fill the approprate text boxes. I did it with DBASE, FoxPlus 2.6 and Visual FoxPro but haven't coaxed Visual Basic 6 into doing it for me.
  I've just taken up Visual Basic in the last couple of years just to learn something new. Been programming since DOS 1 and Vulcan, just trying to teach a 77 year old geek some new tricks. I know it's real simple, just can't see it. Any ideas.
Question by:CopperNose
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3

Expert Comment

ID: 17795661
Are you using databound method?


Author Comment

ID: 17797682
  I assume my answer is Yes since both forms have all their text boxes, mask edit boxes, etc bound to the form ADODC control on that form. The approach I have allways used in the past is as follows.
  When I need to add a applicant to the Assist form I must verify that I have them in my Main Database. I check it for the SSN. If it there I load my variables for the names, address, phone etc. If they are not in Main Database I enter them there at this time and then fill the variables.
    I then return to my Assist form, invoke my AddNew Call and fill the fields with the global variables. The fields clear out as they should but I'm not getting the variables loaded into the blank form.
    I'm trying to load them in the code just after the AddNew Call and the fields clear, this might be the problem. Hope this gives better idea of what I'm doing.
     Thanks, Coppernose


Accepted Solution

lunchbyte earned 250 total points
ID: 17798466
Oh I see, you are trying to reload the data back into the blank form from a variable instead of database, correct?

If so, have you consider just re-query that record to re-populate the fields on the form?

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 17799797
       I know you are going to want to kick me good, but it was just a stupid mistake on my part. I was just trying to load my variables in the wrong place. When it finnaly dawned one me and moved my code it works just like it should in the older programs I had written in prior years. I had been trying to solve it for a couply of weeks, but that is the price old programmers pay. Thanks for all your time and patience.   You deserve the points for hanging in there with me.

Expert Comment

ID: 17802473
Sometime talking with another programmer makes you realize something. I been there so no worry. Thanks for the points anyway.

Author Comment

ID: 17802716
     Fact is your comment is what caused me to find the mistake. I dropped the procedure in the code from my library and I knew it would work because I have used it for years in other code. When you suggested a re-query might work I went to looking just where to implement it. That is when I saw I had put the code in the wrong place, so really you solved the problem.  Thanks,  CopperNose

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Using "ScreenUpdating" 6 84
pop out of webbrowser1 control vba6 5 44
Error with a code discussed on this page 5 39
adding "ungroup sheets" to existing vbs code 5 57
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question