Consulting

Results 1 to 3 of 3

Thread: HELP - The value you entered isn't valid for this field

  1. #1
    VBAX Regular
    Joined
    Jun 2018
    Posts
    8
    Location

    Post HELP - The value you entered isn't valid for this field

    Hi all,

    I have a form with a list of items and when you double click on the item, it copies to a subform. Everything works fine but I added to some of the taks a combo box and when the list related to the combo box is selected, I get error message: " The value you entered isn't valid for this field ". I haven't touched the VBA code just added the code for combo box. This is the code:

    Private Sub List_task_Click() 'fills the taskname list box depending on colorblock selection


    block.Visible = False


    If cmb_freq.Value = "monthly" And List_task.Value = "blue" Then


    block.Visible = True
    strsql = "Select distinct comment from dailytask where Frequency = [Form]!cmb_freq.value and Color = [Form]!List_task.Value"
    block.RowSource = strsql


    Else
    block.Visible = False
    strsql = "SELECT ID, TaskName FROM Dailytask WHERE Frequency = [Form]!cmb_freq.value and Color = [Form]!List_task.Value"
    list_taskcolor.RowSource = strsql
    list_taskcolor.ForeColor = black

    End If

    End Sub

    Private Sub block_Change() 'show the combo box if the tasks belong to a block - THIS IS THE NEW CODE -

    Dim strsql As String


    strsql = "Select IDTaskName, TaskName from Dailytask where comment = ([form]!block.value)"
    list_taskcolor.RowSource = strsql
    list_taskcolor.ForeColor = black


    End Sub

    Private Sub list_taskcolor_DblClick(Cancel As Integer) 'add the list to the subform


    [Dailytask_subform]!IDTaskName = list_taskcolor.Column(0)


    End Sub



    Any ideas or work arounds are really appreciated

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    That kind of message is usually related to a Combo having it's "limit to list" property set to Yes.
    Or as a field there is a Validation Rule set.
    The other possibility is that the block value you are trying to pass to the combo is text and the Combo is actually storing Numeric Values.

  3. #3
    VBAX Regular
    Joined
    Jun 2018
    Posts
    8
    Location
    Thank you for your prompt response. I'll check the combo settings because the other options without the combo, work perfectly.

Posting Permissions

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