Results 1 to 9 of 9

Thread: [RESOLVED] Invalid Property Value: DTPicker

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2013
    Posts
    166

    Resolved [RESOLVED] Invalid Property Value: DTPicker

    EDIT FORM
    Code:
    Private Sub cmdUpdate_Click()
    On Error GoTo errupdate
    executeQuery "UPDATE Finder SET Owner = '" & txtOwner & "', EmployeeNumber = '" & txtEmployeeNumber & "', Acquiredby = '" & txtAcquiredby & "', IDStatus = '" & cboIDStatus & "', Department = '" & cboDepartment & "', IDCount = '" & cboIDCount & "', ReleaseDate = '" & DTPicker2 & "' Where Basura = '" & txtBasura & "';"
    Unload Me
    RefreshListview
    MsgBox "Record successfully Updated", vbInformation, "Abarro ID Finder"
    RefreshListview
    Exit Sub:
    errupdate:
    MsgBox Err.Description, vbExclamation, "Error"
    Set FindCon = Nothing
    Set FindRs = Nothing
    End Sub
    Code:
    Private Sub form_activate()
    FindRecordset "Select * From Finder Where Owner = '" & txtOwner & "';"
    If Not FindRs.BOF = True Or FindRs.EOF = True Then
    txtOwner.Text = FindRs.Fields("Owner")
    txtEmployeeNumber.Text = FindRs.Fields("EmployeeNumber")
    txtAcquiredby.Text = FindRs.Fields("Acquiredby")
    DTPicker2 = FindRs.Fields("ReleaseDate")
    cboIDStatus.Text = FindRs.Fields("IDStatus")
    cboDepartment.Text = FindRs.Fields("Department")
    cboIDCount.Text = FindRs.Fields("IDCount")
    Else
    Call RefreshListview
    End If
    End Sub
    Highlighted Code
    DTPicker2 = FindRs.Fields("ReleaseDate")

    Error
    Run-time error '380':
    Invalid property value

    Screenshot
    Last edited by Cronqvist; Feb 11th, 2014 at 11:02 PM.

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Invalid Property Value: DTPicker

    If possible... please remove those line numbering from posted code - simply use CODE tags instead.
    Also, use indentations for better readability. See sample code below.

    Thanks.

    Code:
    Private Sub Test()
    Dim I as Integer
    
        If I = 1 Then
            'do something
        ElseIf I = 10 Then
            'do something else
        Else
            'do something completely different
        End If
    
    End Sub

  3. #3
    Addicted Member ryanframes's Avatar
    Join Date
    Apr 2012
    Posts
    210

    Re: Invalid Property Value: DTPicker

    Umm maybe Change the DTPicker2 = FindRs.Fields("ReleaseDate") into DTPicker2.value = FindRs.Fields("ReleaseDate")
    Sorry for bad english.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Dec 2013
    Posts
    166

    Re: Invalid Property Value: DTPicker

    Quote Originally Posted by RhinoBull View Post
    If possible... please remove those line numbering from posted code - simply use CODE tags instead.
    Also, use indentations for better readability. See sample code below.

    Thanks.

    Code:
    Private Sub Test()
    Dim I as Integer
    
        If I = 1 Then
            'do something
        ElseIf I = 10 Then
            'do something else
        Else
            'do something completely different
        End If
    
    End Sub
    Sir RhinoBull;4614997 sorry now it looks perfectly sexy xD

    Quote Originally Posted by ryanframes View Post
    Umm maybe Change the DTPicker2 = FindRs.Fields("ReleaseDate") into DTPicker2.value = FindRs.Fields("ReleaseDate")
    Sir ryanframes;4615007 i did what you said but sadly still "Invalid property value"

  5. #5
    Addicted Member ryanframes's Avatar
    Join Date
    Apr 2012
    Posts
    210

    Re: Invalid Property Value: DTPicker

    is the datatype of releasedate is date ?
    Sorry for bad english.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Dec 2013
    Posts
    166

    Re: Invalid Property Value: DTPicker

    Sir ryanframes thank you soo much for your concern about my problem =)
    i really appreciate it.

    I'm soo glad soo proud of myself that I solved my own problem hehe
    here what I did;
    Code:
    Private Sub form_activate()
    FindRecordset "Select * From Finder Where Owner = '" & txtOwner & "';"
    If Not FindRs.BOF = True Or FindRs.EOF = False Then
    txtOwner.Text = FindRs.Fields("Owner")
    txtEmployeeNumber.Text = FindRs.Fields("EmployeeNumber")
    cboIDStatus.Text = FindRs.Fields("IDStatus")
    cboDepartment.Text = FindRs.Fields("Department")
    cboIDCount.Text = FindRs.Fields("IDCount")
    txtAcquiredby.Text = FindRs.Fields("Acquiredby")
    txtRelease.Text = FindRs.Fields("ReleaseDate")
    and add a Texbox - txtRelease

    Code:
    Private Sub DTPicker2_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
    txtRelease.Text = Date
    End Sub

    Here my new problem: http://www.vbforums.com/showthread.p...ble-when-click

  7. #7
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Invalid Property Value: DTPicker

    Quote Originally Posted by Cronqvist View Post
    Code:
    Private Sub DTPicker2_CallbackKeyDown(ByVal KeyCode As Integer, ByVal Shift As Integer, ByVal CallbackField As String, CallbackDate As Date)
        txtRelease.Text = Date
    End Sub
    Don't you have to assign CallbackDate value to txtRelease instead of Date which always returns current date?

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Dec 2013
    Posts
    166

    Re: [RESOLVED] Invalid Property Value: DTPicker

    Sorry Sir Rhino but i don't understand you much

  9. #9
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: [RESOLVED] Invalid Property Value: DTPicker

    First please stop calling me "sir". Thanks.

    Back to your question...

    You coded DTPicker2_CallbackKeyDown event procedure - how it gets triggered is highly questionable however, when it does (or if it does) txtRelease textbox will always get current Date assigned.
    Instead, you may need to use CallbackDate argument value. I hope it's clear now because I wouldn't know how to explain any better.

    Regards.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width