Results 1 to 5 of 5
  1. #1
    V760838 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    10

    Lightbulb copy fields in forms

    Hi everybody,



    I want to copy a text box data of a form to the text box of another form. The first form has only two text boxes and a command button and the second form has many fields. Basically, I want to copy the user ID of the Log-in form to the other form as ID( which is a record source of a table) if the log-in is succesful. I do not know the vb code required to perform the action and where to use the code. Please help me. It would be easier for me if anyone can post an example.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Options:

    1. Pass the user ID value in the OpenArgs argument of DoCmd.OpenForm and ControlSource of textbox would be: = [OpenArgs]
    DoCmd.OpenForm "secondformname", , , , Me.textboxname

    2. Login form code sets value of textbox on second form.
    Forms!secondformname.textboxname = Me.textboxname

    3. Second form textbox ControlSource refers to textbox on first form (first form must remain open): = Forms!firstformname!textboxname
    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
    V760838 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    10
    Thanks for your reply. I am only upto tables, forms and queries. VB coding is quite a jargon to me. However, I am able to copy the codes from databases.So, it is a bit difficult for me to understand the options given by you. It would be a great help if you could give me details as per the following.

    tblLogIn

    pk UserNo( number)
    Password( Text)

    tblTransaction

    UserNo(item)
    BookID(combo)
    BookDetails
    DateRequest(Date)
    DateIssue
    DateReturn

    frmLogin

    UserNo
    Password
    (Login Command Button)

    frmBookRequest

    UserID
    BookID (combo)
    BookDetails
    DateRequest

    frmIssue

    UserID
    BookID
    BookDetails
    DateRequest
    DateIssue
    DateReturn

    Basically I want that as soon as the user clicks the log in command in LOG-IN form, the frmBookrequest should open with the USER ID of frm Log-in to be available in the userID text box of frmBookrequest.

    How can I obtain the above. Thanks in anticipation.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Option 3 I show does not require any code. It uses an expression in the ControlSource property of a textbox.

    For Options 1 and 2, review this for a start http://office.microsoft.com/en-us/ac...010341717.aspx
    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
    V760838 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Feb 2012
    Posts
    10
    Thanks my freind. I will try the option given by you and come back if I get any difficulty. Thank you for your help.

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

Similar Threads

  1. Replies: 3
    Last Post: 05-07-2011, 10:25 AM
  2. Replies: 10
    Last Post: 03-21-2011, 02:46 PM
  3. Copy / Paste some fields
    By isnpms in forum Access
    Replies: 2
    Last Post: 08-25-2010, 10:13 AM
  4. Copy / Paste some fields
    By isnpms in forum Import/Export Data
    Replies: 1
    Last Post: 08-25-2010, 07:48 AM
  5. Skipping Fields in forms
    By who in forum Forms
    Replies: 1
    Last Post: 06-17-2009, 12:01 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