Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Not In List and a Date

Posted on 2014-11-16
3
Medium Priority
?
150 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

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…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

670 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