Solved

Not In List and a Date

Posted on 2014-11-16
3
147 Views
Last Modified: 2014-11-16
Experts,

I have the code below that inserts text if the text is not in the drop down list.
It works fine.
I need to modify as the options are no longer text but now they are dates (cboInitiates is a date...not text).
I think I have to change the Dim Msg ast String to something else but I think  I need to make a change elsewhere.

Please let me know where to make the edits.

thank you
let me know if you need additional info.


Private Sub cboInitiates_NotInList(NewData As String, Response As Integer)

    
         Dim Msg As String
On Error GoTo cboInitiates_NotInList_Err
blAddBank = False  'this needs to match the on load of the ad list form below in
    If NewData = "" Then Exit Sub
    Msg = "'" & NewData & "' is not on the list." & vbCr & vbCr
    Msg = Msg & "Do you want to add it?"
    If MsgBox(Msg, vbYesNo + vbQuestion, "NotListed") = vbNo Then
        Response = acDataErrContinue
        Me.cboInitiates.SelStart = 0
        Me.cboInitiates.SelLength = Len(Me.cboInitiates.Text)
        
        Else
        DoCmd.OpenForm "frmImportantDate_Add", , , , acFormAdd, acDialog, OpenArgs:=NewData
                                
        If blAddBank Then
            Response = acDataErrAdded
            Me.cboInitiates.RowSource = Me.cboInitiates.RowSource
            Else
            Response = acDataErrContinue
        End If    


    End If

cboInitiates_NotInList_Exit:
    Exit Sub
cboInitiates_NotInList_Err:
    MsgBox Err.Description
    Response = acDataErrContinue
    Resume cboInitiates_NotInList_Exit


End Sub

Open in new window

0
Comment
Question by:pdvsa
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 40446536
try changing this

Private Sub cboInitiates_NotInList(NewData As String, Response As Integer)


with

Private Sub cboInitiates_NotInList(NewData As Date, Response As Integer)
0
 

Author Closing Comment

by:pdvsa
ID: 40446545
Thank you
Perfect
0
 
LVL 3

Expert Comment

by:jcrozier21
ID: 40446548
What is the specific error message you are getting? Which line is highlighted when the debugger stops the process?
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question