Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2019
    Posts
    5

    Adding Text Box info From a Form Help Please

    Hello everyone,


    I am trying to create a Maintenance Log DB. I need to create a log entry with a date, customer info, and Rig info. I want the Rig info to be in the tblLoftRecord and not change when the rig it self has any changes. I have a Form frmLoftRecord that pulls the info from different sources and displays all the info I want after the few selections I have to pick from. I have got it able to update with a button running SQL statement. The problem is the form gets updates and created from Combo Boxes, date box and several other form fields. When I click the button is runs the SQL command and creates a new record with that info. I also put the form and table n a group called test. Right at the top.

    Thanks for any help.

    Shannon

    Loft2.zip

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    If you don't want record initiated when selections made in comboboxes then don't use bound form and don't bind to fields. Otherwise, make sure form is on new record row and instead of INSERT action, just set values of fields for new record initiated, like:

    Me!Model = Me.txtResModel

    Can even set form so only new records are added. If DataEntry property is set to Yes then form will open to new record row. Existing records will not be retrieved.



    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Join Date
    Sep 2019
    Posts
    5
    Quote Originally Posted by June7 View Post
    If you don't want record initiated when selections made in comboboxes then don't use bound form and don't bind to fields. Otherwise, make sure form is on new record row and instead of INSERT action, just set values of fields for new record initiated, like:

    Me!Model = Me.txtResModel

    Can even set form so only new records are added. If DataEntry property is set to Yes then form will open to new record row. Existing records will not be retrieved.




    Thanks for the reply. I tried to not bind the fields and then they do not populate with the data. I have a Combo box that pulls the info from a contact query. When the cbo is not bound to the customerID on the table I get the drop down but I am unable to select any of the values.

    Shannon

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    I tested your form unbound and unbound combobox works. The DLookup() would have to reference combobox column, not CustomerID or RigID fields because fields are not available on unbound form.

    So why not use alternative suggestion for saving data with bound form?

    Regardless of method for saving, I would not use DLookup(). I would use multi-column combobox and include all fields needed in RowSource. Then textboxes can reference combobox columns by index, index begins with 0. =cboRigID.Column(1)

    A side note. You have a label caption
    Owner's Name & Address. This includes & character and there is a warning associated because & is a special character which in this case defines an ALT+key shortcut. If you want the literal & character, need to double it: Owner's Name && Address
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Join Date
    Sep 2019
    Posts
    5
    Quote Originally Posted by June7 View Post
    I tested your form unbound and unbound combobox works. The DLookup() would have to reference combobox column, not CustomerID or RigID fields because fields are not available on unbound form.

    So why not use alternative suggestion for saving data with bound form?

    Regardless of method for saving, I would not use DLookup(). I would use multi-column combobox and include all fields needed in RowSource. Then textboxes can reference combobox columns by index, index begins with 0. =cboRigID.Column(1)

    A side note. You have a label caption
    Owner's Name & Address. This includes & character and there is a warning associated because & is a special character which in this case defines an ALT+key shortcut. If you want the literal & character, need to double it: Owner's Name && Address

    Thanks for the help. I will work on your suggestions and see if I can get them to work.

    Shannon

  6. #6
    Join Date
    Sep 2019
    Posts
    5
    Quote Originally Posted by June7 View Post
    I tested your form unbound and unbound combobox works. The DLookup() would have to reference combobox column, not CustomerID or RigID fields because fields are not available on unbound form.

    So why not use alternative suggestion for saving data with bound form?

    Regardless of method for saving, I would not use DLookup(). I would use multi-column combobox and include all fields needed in RowSource. Then textboxes can reference combobox columns by index, index begins with 0. =cboRigID.Column(1)

    A side note. You have a label caption
    Owner's Name & Address. This includes & character and there is a warning associated because & is a special character which in this case defines an ALT+key shortcut. If you want the literal & character, need to double it: Owner's Name && Address

    Thanks again for the help.

    I have my form bound to the table and have the Multi-Column Comobox set up and working to display the info I want on the form in Text Boxes. How do i get the info from the text box into my table.

    text box control source "=[Forms]![frmLoftRecord]![Combo387].[Column](3)" Displays the info

    Not sure how to how to bind or write data to the filed in the table.

    Shannon

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Example in post 2.

    Me!Model = Me.txtResModel

    or instead of expression in textbox, bind textbox to field and then VBA just references combobox

    Me!Model = Me.[Combo387].[Column](3)

    This will actually allow user to modify value in textbox. So if you don't want to allow that, then go with first method or set textbox Locked Yes and TabStop No.


    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    Join Date
    Sep 2019
    Posts
    5
    Quote Originally Posted by June7 View Post
    Example in post 2.

    Me!Model = Me.txtResModel

    or instead of expression in textbox, bind textbox to field and then VBA just references combobox

    Me!Model = Me.[Combo387].[Column](3)

    This will actually allow user to modify value in textbox. So if you don't want to allow that, then go with first method or set textbox Locked Yes and TabStop No.



    Thanks for the help. I got it working after a few days of trail and error and figuring out all the parts.

    Thanks
    Shannon

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 10-25-2014, 10:41 AM
  2. Adding New Info to Table and Updating Form
    By MTSPEER in forum Forms
    Replies: 6
    Last Post: 06-05-2013, 05:48 PM
  3. Replies: 7
    Last Post: 10-17-2012, 11:59 AM
  4. Adding additional info to a hyperlink address
    By Greyhound in forum Access
    Replies: 4
    Last Post: 07-02-2012, 02:36 PM
  5. Replies: 11
    Last Post: 01-06-2010, 03:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums