Solved

Not In List and a Date

Posted on 2014-11-16
3
145 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

777 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