Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    106

    Unanswered: what is wrong with my code

    I'm having trouble dealing with recordsets when it comes to assigning the values to an UNBOUND form. When I run the following code, I end up navigating through the correct number of records but with the same value showing on the form. Please help.

    strColumnValue = Me.Column_Value
    strCarrier = Me.Supplier_Code

    strQuery1 = "Select tbl_Rules.* From tbl_Rules Where [Column Value] = '" & strColumnValue & "' And [Carrier Code]= '" & strCarrier & "'"

    Set rs1 = CurrentDb.OpenRecordset(strQuery1)
    Set Form_frm_Rules.Recordset = rs1
    rs1.MoveFirst
    Form_frm_Rules.Business_Partner = rs1![Business_Partner]
    Do While Not rs1.EOF
    rs1.MoveNext
    Form_frm_Rules.Business_Partner = rs1![Business_Partner]
    Loop

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    tilting at windmills as the saying goes.

    perhaps you would like to fake showing many unbound forms, one for each record of your recordset? the only way i can think of doing this right is to use bound forms (patience! it will be explained) with your strQuery1 as .recordsource

    in design view .visible = no all of your bound textboxes etc and then make new unbound textboxes etc on the same form and set their default value to their bound cousins.

    voila! you have the multi-form/continuous form that you wanted with user-editable data that is unbound.

    sooooooo. drop your original recordset manipulation completely, set your forms .recordsource to your SQL statement, and finally use SQL UPDATE (or recordset if you really must) to save anything that you want to save after the user has finished messing around with your unbound fields.

    does this do it?

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Feb 2004
    Posts
    106
    That's exactly what I was looking for. Thanks Izyrider.

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    good!

    now try a further experiment: drop most of the bound controls on the form(try keeping just e.g. the ID) - you should still be able to set the default values of the unbound controls if you get the naming right, and it makes your form easier to design & maintain.

    izy
    Last edited by izyrider; 05-21-04 at 04:18.
    currently using SS 2008R2

Posting Permissions

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