=> CboValue saved to variable & variable in Email subject line

R

Rhonda Fischer

Hello,

When the User selects a Trailer Number from a drop down
list box I would like to send an email to a staff member
if this Trailer needs to be serviced.

I have the function (fnCheckTrailerStopped)
working correctly returning a True
if the Trailer is in need of servicing.
The code I am using:

----------------------------------------------------------
Private Sub cboTrailerNo_Change()

Dim inTrlNo As String

inTrlNo = [Forms]![Frm Turners Vehicles In]!
[cboTrailerNo]

If (fnCheckTrailerStopped(inTrlNo) = False) Then
MsgBox ("This Trailer is Workshop Stopped")
DoCmd.SendObject
acSendReport, "rptTrlNoWorkshopStopped", "rich text
format", "(e-mail address removed)", , , "Trailer
Workshop Stopped"
End If

End Sub
---------------------------------------------------------

PROBLEM 1: Not picking up the Value contained in the
========= [cboTrailerNo] combo box

The combo box Row Source:
SELECT [FleetNumber],[TrlNo] FROM [SQLTrailers] ORDER
BY [TRLNo];

With a column count of two and a bound column of 1.
How do I simply pick the FleetNumber displayed in the combo
box????

PROBLEM 2: Can I email a message simply stating in the
========= subject line the Trailer that needs serviced

This value is contained in the variable: inTrlNo ???


Thank you very much for your thoughts.

Kind Regards
Rhonda
 
J

Jonathan Parminter

----- Rhonda Fischer wrote: ----

Hello

When the User selects a Trailer Number from a drop dow
list box I would like to send an email to a staff membe
if this Trailer needs to be serviced.

I have the function (fnCheckTrailerStopped)
working correctly returning a Tru
if the Trailer is in need of servicing.
The code I am using

---------------------------------------------------------
Private Sub cboTrailerNo_Change(

Dim inTrlNo As Strin

inTrlNo = [Forms]![Frm Turners Vehicles In]
[cboTrailerNo

If (fnCheckTrailerStopped(inTrlNo) = False) The
MsgBox ("This Trailer is Workshop Stopped"
DoCmd.SendObject
acSendReport, "rptTrlNoWorkshopStopped", "rich text
format", "(e-mail address removed)", , , "Trailer
Workshop Stopped
End I

End Su
--------------------------------------------------------

PROBLEM 1: Not picking up the Value contained in th
========= [cboTrailerNo] combo bo

The combo box Row Source
SELECT [FleetNumber],[TrlNo] FROM [SQLTrailers] ORDER
BY [TRLNo]

With a column count of two and a bound column of 1.
How do I simply pick the FleetNumber displayed in the comb
box???

PROBLEM 2: Can I email a message simply stating in th
========= subject line the Trailer that needs service

This value is contained in the variable: inTrlNo ??


Thank you very much for your thoughts

Kind Regard
Rhonda

Hi Rhonda
P1 - the field [FleetNumber] appears to be the first column of the listbox. Just reference the listbox as this is also the bound column. For example
strFleetNumber = cboTrailerNo.valu

For any other column use the column property. For example -
strTrlNo = cboTrailerNo.column(1) ' column property is zero (0) based

P2 - 'Yes

Luc
Jonathan
 
Top