Wrox Programmer Forums
BOOK: Beginning Access 2003 VBA
This is the forum to discuss the Wrox book Beginning Access 2003 VBA by Denise M. Gosnell; ISBN: 9780764556593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Access 2003 VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 4th, 2009, 05:33 AM
Registered User
Join Date: Aug 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Addnew record

Hi at all
I'm new on wrox p2p forum
I read the chapter 5 of this book and in particular the section regarding "building an unbound form"

I'm interested to create a button "add new record" on a extisting bounded form and use it instead of standard buttons, without writing "populateControlsonform" routine, because in my form I've got a submask and a lot of "Combo" controls.

I'm tried to use the "addnew" method, but without success: the record is created, but I'm not able to modify it: when I enter in the first field, I can add chars but I can't exit from the filed and pass to next field


Private Sub Form_Load()
Dim cnCh5 As ADODB.Connection

Dim strConnection As String
strConnection = "Provider=Microsoft.jet.OLEDB.4.0;" & _
"Data source=" & CurrentProject.Path & "\Chap_05_mio_esercizio.mdb;"

Set cnCh5 = New ADODB.Connection
cnCh5.Open strConnection

Set rsContacts = New ADODB.Recordset

With rsContacts
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.Open "select * from tblContacts", cnCh5
End With

If rsContacts.BOF And rsContacts.EOF Then
MsgBox "There are no records in the db"
Set Me.Recordset = rsContacts
End If
Me.txtLastName.ControlSource = "txtLastName"
Me.txtFirstName.ControlSource = "txtFirstName"
Me.txtMiddleName.ControlSource = "txtMiddleName"
'Me.txtContactId.ControlSource = "intContactId"

End Sub

Private Sub cmdMoveNext_Click()
If Not rsContacts.EOF Then
End If
End Sub

Private Sub cmdAddNew_Click()
End Sub

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help regarding Addnew Kaustav Classic ASP Databases 8 January 10th, 2010 06:33 PM
AddNew with SQL Server... neo_jakey Classic ASP Databases 0 April 16th, 2008 01:26 PM
Addnew with oracle mail4nrs Classic ASP Databases 0 August 23rd, 2004 10:10 AM
addnew problem [email protected] Classic ASP Basics 6 February 24th, 2004 01:08 AM
addnew method jesuseyi Classic ASP Databases 1 August 27th, 2003 02:46 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.