Set focus on a different Form

J

John

I am sure this is easy to do but for the life of my I can't figure it out.
Any help for a self taught would be great

I currently have this on my customers form organized to e-mail someone that
the job is complete and the set the status as complete. Works fine...


Private Sub Command338_Click()
If IsNull([SignedOffDate]) Then
MsgBox ("Please enter in a signed off date")
Else

DoCmd.SendObject , acSendNoObject, , "e-mail address", , , "Customer
Complete " & [AssignedCustNumber] & " (" & [LastName] & ", " & [FirstName] &
")", [OwnerInfo] & Chr(13) & Chr(10) & "Therms Saved according to
multifamily= " & [Text404] & Chr(13) & Chr(10) & " " & Chr(13) & Chr(10) &
"John", True
[WrappedUpDate] = Date
[AcitivityStatus] = "Complete"
DoCmd.GoToControl ("Text136")
End If
End Sub

I have a button that pops up a options menu which is simply a form with
buttons on it. What I would like is a button on that form to do all of the
above code but I can't figure it out. This is what I have right now but it
doesn't work. Thanks in advance.

Private Sub Command29_Click()
DoCmd.Close
Me.frmcustomers.SetFocus
If IsNull([SignedOffDate]) Then
MsgBox ("Please enter in a signed off date")
Else

DoCmd.SendObject , acSendNoObject, , "EmailAddress", , , "Customer Complete
" & [AssignedCustNumber] & " (" & [LastName] & ", " & [FirstName] & ")",
[OwnerInfo] & Chr(13) & Chr(10) & "Therms Saved according to multifamily= " &
[Text404] & Chr(13) & Chr(10) & " " & Chr(13) & Chr(10) & "John", True
[WrappedUpDate] = Date
[AcitivityStatus] = "Complete"
DoCmd.GoToControl ("Text136")
End If
End Sub
 
N

NG

Hi John,

you can refer to a control on another form as:
Forms("Name from")![ControlName]

If you do so, you better first check if the form is open. To do so I use
the following function:

Public Function gfgIsOpen(strName As String, Optional intObject As Integer =
acForm)


'Function to check whether an object is opened, when no object type is
'specified Access assumes a form

gfgIsOpen = (SysCmd(acSysCmdGetObjectState, intObject, strName) <> 0)


End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top