Solved

Not In List and a Date

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

Accepted Solution

by:
Rey Obrero 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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of utilizing SQL Server views 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 Microsoft Access…

705 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now