By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,663 Members | 1,455 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,663 IT Pros & Developers. It's quick & easy.

problems with Add record functionality

P: n/a
Hey all -

I have a windows form (using VB) in which I display basic information
about a person, all of which is housed (for now) in a single Access
table, which I'll call "tblPerson". I would like to select a set of
records and display one at a time in text boxes with the following
buttons:

Next - Moves to next record
Previous - Moves to previous record
Add - Adds a blank new record
Delete - Deletes the current record
Save - Saves any changes back to the DB.

Pretty standard stuff. I am using a CurrencyManager to manage record
position in the dataset. The data shows correctly and the record
navigation works fine. The issue that I am dealing with right now, is
as follows:

When make a call to cmPeople.AddNew() NOTHING happens! I do not get a
blank record to display as desired. That said, cmPeople.Count is
incremented by 1 when I click my Add button. Any ideas? Below is
some relevant code:
Private Sub GetPersonMain()
...

daPersonMain = New OleDbDataAdapter(strPersonMainSQL, cnConnection)
ds = New DataSet
daPersonMain.Fill(ds, "PersonBasic")
...
Me.txtFirstName.DataBindings.Add("text", ds,
"PersonBasic.name_first")
Me.txtLastName.DataBindings.Add("text", ds,
"PersonBasic.name_last")

cmPeople = CType(BindingContext(ds, "PersonBasic"),
CurrencyManager)
End Sub
***

Private Sub mnuAddNewPerson_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles mnuAddNewPerson.Click

cmPeople.AddNew()

End Sub

Any ideas???

Thx.Brian
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Brian -

It is most likely due to the way the controls handle Null values. Check out
this article and see if this helps your particular situation. (your app may
not use a checkbox but try setting a default value for your columns to see
if the record is added.

You can check out this article
BUG: AddNew Method of CurrencyManager Fails with Bound CheckBox
http://support.microsoft.com/default...b;en-us;326440
hope this helps

Steve Stein,
Visual Basic Team

--------------------------------------------------------------------
This reply is provided AS IS, without warranty (express or implied).


--------------------
| From: br*********@yahoo.com (Brian)
| Newsgroups:
microsoft.public.dotnet.framework.adonet,microsoft .public.dotnet.languages.v
b
| Subject: problems with Add record functionality
| Date: 15 Oct 2003 18:14:06 -0700
| Organization: http://groups.google.com
| Lines: 52
| Message-ID: <be*************************@posting.google.com>
| NNTP-Posting-Host: 64.170.104.17
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1066266847 10740 127.0.0.1 (16 Oct 2003
01:14:07 GMT)
| X-Complaints-To: gr**********@google.com
| NNTP-Posting-Date: Thu, 16 Oct 2003 01:14:07 +0000 (UTC)
| Path:
cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!news-out.cwix.com!newsfeed.cwix.co
m!news.maxwell.syr.edu!postnews1.google.com!not-for-mail
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:147146
microsoft.public.dotnet.framework.adonet:63730
| X-Tomcat-NG: microsoft.public.dotnet.languages.vb
|
| Hey all -
|
| I have a windows form (using VB) in which I display basic information
| about a person, all of which is housed (for now) in a single Access
| table, which I'll call "tblPerson". I would like to select a set of
| records and display one at a time in text boxes with the following
| buttons:
|
| Next - Moves to next record
| Previous - Moves to previous record
| Add - Adds a blank new record
| Delete - Deletes the current record
| Save - Saves any changes back to the DB.
|
| Pretty standard stuff. I am using a CurrencyManager to manage record
| position in the dataset. The data shows correctly and the record
| navigation works fine. The issue that I am dealing with right now, is
| as follows:
|
| When make a call to cmPeople.AddNew() NOTHING happens! I do not get a
| blank record to display as desired. That said, cmPeople.Count is
| incremented by 1 when I click my Add button. Any ideas? Below is
| some relevant code:
|
|
| Private Sub GetPersonMain()
| ...
|
| daPersonMain = New OleDbDataAdapter(strPersonMainSQL, cnConnection)
| ds = New DataSet
| daPersonMain.Fill(ds, "PersonBasic")
| ...
| Me.txtFirstName.DataBindings.Add("text", ds,
| "PersonBasic.name_first")
| Me.txtLastName.DataBindings.Add("text", ds,
| "PersonBasic.name_last")
|
| cmPeople = CType(BindingContext(ds, "PersonBasic"),
| CurrencyManager)
| End Sub
| ***
|
| Private Sub mnuAddNewPerson_Click(ByVal sender As System.Object, ByVal
| e As System.EventArgs) Handles mnuAddNewPerson.Click
|
| cmPeople.AddNew()
|
| End Sub
|
| Any ideas???
|
| Thx.Brian
|

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.