Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / November 2006

Tip: Looking for answers? Try searching our database.

Setting field in another form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill - 13 Nov 2006 01:45 GMT
Can't seem to get the syntax correct for the assignment
statement seen in Sub tbMov3_LostFocus. I need to
set the corresponding text box in the calling form after
focus moves from one control to another. (Only
pertinent code posted below)

Option Compare Database
Option Explicit
Dim strCallingForm As String

Private Sub Form_Open(Cancel As Integer)
Dim Atmp() As String
Dim strStartField As String
'============================================================
' OpenArgs contains the name of the "calling" form and the control name on
that form that
' currently has the focus, separated by a semicolon. There is a one-to-one
correspondance
' between the text box controls on the current and calling forms.
'============================================================
Atmp = Split(Me.OpenArgs, ";")
strStartField = Trim(Atmp(1))
strCallingForm = Trim(Atmp(0))
Me.Controls(strStartField).SetFocus

End Sub
-------------------------------------------------------------------------------------------
Private Sub tbMov3_LostFocus()
If Len(Trim(Me.tbMov3)) > 0 Then
Forms![strCallingForm].Form!Controls("tbmov3") = Me.tbMov3

End Sub
------------------------------------------------------------------------------------------
Bob Hairgrove - 13 Nov 2006 02:47 GMT
>Can't seem to get the syntax correct for the assignment
>statement seen in Sub tbMov3_LostFocus. I need to
[quoted text clipped - 29 lines]
>End Sub
>------------------------------------------------------------------------------------------

You're almost there! Just change the last line to this:
   Forms(strCallingForm).tbmov3 = Me.tbMov3

(and don't forget "End If" if this is really on a separate line.)

--
Bob Hairgrove
NoSpamPlease@Home.com
Bill - 13 Nov 2006 03:21 GMT
Great! I tried to find syntax references regarding the
forms collection, but seemed to find everything but.
Was that particular syntax available in A2K?
Bill

>Can't seem to get the syntax correct for the assignment
>statement seen in Sub tbMov3_LostFocus. I need to
[quoted text clipped - 29 lines]
>End Sub
>------------------------------------------------------------------------------------------

You're almost there! Just change the last line to this:
   Forms(strCallingForm).tbmov3 = Me.tbMov3

(and don't forget "End If" if this is really on a separate line.)

--
Bob Hairgrove
NoSpamPlease@Home.com
Bob Hairgrove - 13 Nov 2006 16:47 GMT
>Great! I tried to find syntax references regarding the
>forms collection, but seemed to find everything but.
>Was that particular syntax available in A2K?
>Bill

It was in Access 97 already, or even as early as Access 2 -- but you
needed to always use the bang instead of the dot in Access 2, IIRC.

--
Bob Hairgrove
NoSpamPlease@Home.com
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.