Results 1 to 7 of 7

Thread: To access a text field from another form

  1. #1
    Join Date
    Jan 2009
    Posts
    19

    To access a text field from another form

    Hello,
    I am working with Visual Studio, dot net forms.
    I have 2 forms Form X & Form Y.
    I am opening Form Y on Form X using ShowDialog(). Now what I am looking for is a way to access a text field on Form Y(Called form) to Form X(Calling form).
    Please help me in this situation.

  2. #2
    Join Date
    May 2008
    Posts
    115

    Re: To access a text field from another form

    Hi,
    Can you tell us with some details what you exactly want to achieve?
    Thanks,

  3. #3
    Join Date
    May 2008
    Posts
    40

    Re: To access a text field from another form

    For a ShowDialog form I mostly use simple "friend" fields in the showdialog
    form, that gives me the most flexibility. this is not correct but I do this
    only by one time to use ShowDialog forms.

  4. #4
    Join Date
    May 2008
    Posts
    63

    Re: To access a text field from another form

    Use the overload on ShowDialog() and pass in the calling form as the owner.
    Now from the called form you can access a public member on the calling form.

    Code:
    Dim owner = TryCast(Owner, Form1)
    
    If owner IsNot Nothing Then
    '// Do something cool with the form
    End If
    I think this will help you!

  5. #5
    Join Date
    Jan 2009
    Posts
    22

    Re: To access a text field from another form

    what you're
    trying to do could be done for free by Access by setting up a query
    containing the tables for both forms - they must be related, surely?

  6. #6
    Join Date
    May 2008
    Posts
    26

    Re: To access a text field from another form

    When you want to open the second form, from say a button click, use
    code like this on the button in the first form:

    DoCmd.OpenForm stDocName, acNormal, , , , , Me.boxFID

    Where stDocName is the name of the second form and Me.boxFID is the
    field that contains the value you want to pass.
    The commas are all needed, they are for different options when opening
    a form.

    Then use code like this in the 'on open' event of the second form:

    If Not IsNull(Me.OpenArgs) Then
    Me.boxFinder.Value = Me.OpenArgs
    Me.Requery
    End If

    Me.OpenArgs will be equal to whatever value you passed from the event
    in the first form.

  7. #7
    Join Date
    May 2008
    Posts
    44

    Re: To access a text field from another form

    Code:
    form2.text1.text=text1.text
    assuming that the command will be fired from the current form

Similar Threads

  1. count commas in a text field in Access
    By SeaGuy in forum Windows Software
    Replies: 4
    Last Post: 07-09-2011, 08:12 PM
  2. Date field in HTML form
    By Messenger in forum Software Development
    Replies: 6
    Last Post: 29-07-2010, 10:30 AM
  3. Switch the 'action' field in an HTML form
    By MarceloQuad in forum Software Development
    Replies: 4
    Last Post: 07-02-2010, 06:05 AM
  4. Multi Field value field in Microsoft Access
    By Erubiel in forum Windows Software
    Replies: 3
    Last Post: 20-11-2009, 12:55 AM
  5. Disable yellow autocomplete form field
    By teenQ in forum Technology & Internet
    Replies: 3
    Last Post: 06-08-2009, 09:57 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,710,836,978.55322 seconds with 17 queries