Sequential Numbering with a combo box text suffix (1 Viewer)

InAboveMyHead

New member
Local time
Today, 21:35
Joined
Dec 17, 2021
Messages
4
Seasons greeting's to everyone.

1st post so please go gentle, I have a couple of coding queries I would love some help with if possible, I am guessing this first one is very simple...

Currently I have


Code:
    Private Sub Command50_Click()

        Me.DeliveryNumber = Format(Date, "yyyymmdd") + Format(Time, "hhmm") + Me.cboRecievedBy

    End Sub


The cboRecievedBy references a field which is generated from the EmployeeID in tblEmployee whereby the link is a number but the meaningful entry on the form is the EmployeeInits

Obviously, in its current format the code simply adds the numerical value onto the calculated date/time value! whereas I would like the actual EmployeeInits to be added,

is that possible?

Failing that, is there another elegant solution?

Thanks in advance!
 

oleronesoftwares

Passionate Learner
Local time
Today, 14:35
Joined
Sep 22, 2014
Messages
1,159
Me.DeliveryNumber = Format(Date, "yyyymmdd") + Format(Time, "hhmm") + Me.cboRecievedBy.column(1)

where the select query returns
id as first column
initials as second column.

and column count property is set to 2
 

InAboveMyHead

New member
Local time
Today, 21:35
Joined
Dec 17, 2021
Messages
4
Is there also some simple code which I can add in addition to

Code:
DoCmd.Close

which will fire off an email when Command50 button is pressed?
 

InAboveMyHead

New member
Local time
Today, 21:35
Joined
Dec 17, 2021
Messages
4
I had previously used

Code:
Private Sub Command47_Click()
    
    Dim Msg As String
    
    Msg = "Delivery " & Delivery_num & " on " & Del_date & ",<P>" & _
        "of " & No_of_Boxes_or_Pallets & "from " & Client_or_Sender & ",<P>" & _
        Desc_1 & "<P>" & _
        Desc_2 & "<P>" & _
        Desc_3 & "<P>" & _
        Desc_4 & "<P>" & _
        Desc_5 & "<P>" & _
        "Received by " & Receiver
      
    Dim O As Outlook.Application
    Dim M As Outlook.MailItem
    
    Set O = New Outlook.Application
    Set M = O.CreateItem(olMailItem)
    
    With M
        .BodyFormat = olFormatHTML
        .HTMLBody = Msg
        .To = "In@OverMyHead.co.uk"
        .Subject = "Goods in delivery"
        .Display
        
    
    End With
    
    
    Set M = Nothing
    Set O = Nothing

End Sub

But in reality the actual method of recording which I inherited wasnt great so although this code did fire an email the whole process needed addressing which is what I am trying to do now with the new data entry system via forms etc
 

Users who are viewing this thread

Top Bottom