Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003

    Unanswered: filling in controls on a continuous form via VB

    If I have a form's view set to continuous and I'd like to populate some controls via VB, how do I reference the controls so Access knows which record I am referring to?

    for reference, lets say we have Form1 with 2 textboxes txt1 and txt2. What would the syntax be to loop through a record set and fill in values from it onto a form?

    I am trying to auto-populate as much data as I can and then let the user fill in the nitty gritty details.

  2. #2
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    you could run an update query against the record set.

    The control is just a container for the recordset, you need to alter the recordset itself.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Oct 2003
    Are Txt1 and txt2 unbound textboxes? I am asking that because usually only unbound controls need to be populated manually. As well, unbound controls on a continuous form usually do not work as expected. The best way to populate controls on continuous forms is to bind them to fields in the form's record source.

    I have used the following code to convert a column of data to a grid in a table then used that table to power a continuous form. If the population of the data is done manually like this, then saving the values from the form has to be done manually as well.

    rsO!SGCode = SGCode

    For Y = 1 To TotCol - 1
    rsO("Salary" & Right("0" & Y, 2)) = Salary(Y)
    Next Y

    Of course if txt01 and txt02 are in the header or footer then you can simply populate them using code like this:

    for y = 1 to 2
    me.Controls("txt" & Format(x, "00")) = rsO("txt" & Right("0" & Y, 2))
    next y

Posting Permissions

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