Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2013
    Location
    Chesapeake, VA
    Posts
    30

    Unanswered: Updating a field in a open or current record

    Can someone explain to me if my understanding of this subject below is correct?

    If I have a form open to "add" records and I am currently in the middle of the form, what state is that record in. I know obviously it is not closed, has the record been created yet? The issue I have is: can I edit or update a field with a VBA subroutine before the record is closed?

    If so how? Can someone show me?

    The table is called allocation and the field to update is QTY_Allocated

    I appreciate anyone's input and support on this because it is kicking my butt.

    Dale
    Last edited by back2basics; 02-27-13 at 14:57.

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Easy enough to test. Start a record, then open the table and see if it's there yet. As a rule it would not yet be created. Your VBA could simply modify the value on the form. If you want to modify the value directly in the table, you'd probably have to force a save first.
    Paul

  3. #3
    Join Date
    Jan 2013
    Location
    Chesapeake, VA
    Posts
    30
    Good enough, and you are correct it is not there.....of course. I was hoping to not have to put the value on the form since the user is prompted for the value ( which BTW is a integer for quantity) in the VB Code.

    Are you saying if I put the field on the form, I can update it? Using the VB Code? If so it is not a value that I want the user to be able to change unless the entire order entry is cancelled.

    Does this sound common?

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    If the value is part of the record being displayed on the form, then it is certainly simplest to have it on the form. It can be hidden from the user, or locked so they can't change it. In whatever your VBA code is, at the end:

    Me.TextboxName = YourDesiredValue

    which will work with a hidden, disabled or locked textbox bound to the underlying table.
    Paul

  5. #5
    Join Date
    Jan 2013
    Location
    Chesapeake, VA
    Posts
    30
    Thanks this makes sense and what I will do. Two more simple questions I hope. Do I bind the text to an entire table or just the field ? Lastly, I hate to ask, but how does the textbox get bound to a table?

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Well, a textbox can only be bound to a field in a table if the form is bound to that table. That's why I said "If the value is part of the record being displayed on the form". The form's record source property determines what it's bound to, the textbox's control source property determines which field of the form's source it's bound to.
    Paul

  7. #7
    Join Date
    Jan 2013
    Location
    Chesapeake, VA
    Posts
    30
    OK thank you, got some HW to do.

  8. #8
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    No problem, post back if you get stuck.
    Paul

Posting Permissions

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