Hi.... I have a datepicker that contains an alternate key of an Access Table with a autokey primary key.

Private Sub DateTimePicker1_Validating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles DateTimePicker1.Validating

        Dim d As Date = DateTimePicker1.Value
        If d < Today Then
            MsgBox("Gelieve een datum in de toekomst te willen aangeven.")
            Exit Sub
        End If
        Dim n As Integer = Me.FeestdagenTableAdapter.Fill(Me.FeestdagenDataset.Feestdagen, d)
        If n = 0 Then
            Me.DateTimePicker1.Value = d
            Exit Sub
        End If
    End Sub

I have a "Save" Button

Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click
        Me.DateTimePicker1.Value = Today
        Me.TextBox1.Text = ""
    End Sub

Now this works fine in update mode, but in add (insert mode) the primary key is generated and the other field FD_Naam is updated alright, but FD_Datum is blank.

When I put a msgbox(me.datapicker1.value) it is set correctly when it gets in the save_click. How can I see/set what is "bound" int the Bindingsource? (I mean what would be the syntax to check what is / directly write in the form's dataset?).

Thanks for any light you could shed on this.

6 Years
Discussion Span
Last Post by PerplexedB

OK. It works now. I'm not sure what had caused my problem in the first place.

I was able to "see" the dataset using this in the immediate window :

? Me.FeestdagenDataset.Feestdagen.Rows(0)("FD_Datum").ToString


you could have set a breakpoint or used a try/catch and viewed the exception message, I have little experience with Access as for work we mainly use SQL Server 2005, you could have run a trace to see what is actually being executed on the database(If it can even be done in Access, i'm not familiar with it)


Basically what you described is what I did. I was wondering about the syntax (aka trying to find my way in the oo model labyrinth) how to get the info, not about how to use the IDE.

As is probably very obvious, I'm just starting with vb (coming from Visual Foxpro), so I'm not going to comment on my experience with using an Access database. :)

Kind Regards,



Ah I understand, VB.net doesn't really take long to get to grips with, i suppose it can be compared to riding a bike, once you know how, you'll never forget :)

- Jordan

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.