473,597 Members | 2,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

adding new record using VBA into existing access database

2 New Member
Hello guys, I'm new to VBA and trying to create a form for inserting new records into an existing access database, the thing is the database is provided by a third party so I don't have control over it's fields specification. there's already 26705 rows I'd like the insertion of new records to continue in the same sequence, that's the code I've used:
Private Sub Command19_Click ()

Dim dbConf As DAO.Database
Dim rstNew As DAO.Recordset

Set dbConf = CurrentDb
Set rstNew = dbConf.OpenReco rdset("N-MATTE")

rstNew.AddNew
rstNew("DATE"). Value = Me.txtDate.Valu e
rstNew("CLIENT" ).Value = Me.txtClient.Va lue
rstNew.Update

End Sub
Sep 18 '16 #1
2 1074
5236
2 New Member
To be more specific, I would like the record id to be auto-generated without having to add it by the form.
Sep 18 '16 #2
informerFR
14 New Member
Hi 5236

If you declare an auto number field on a table, this field increments itself automatically when you add a record on this table. Nothing to do.
Sep 19 '16 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

12
20887
by: Wadim Grasza | last post by:
I want to store and display (on a form or a report) multiple pictures per record in an access database. The pictures are not stored within the database. They are stored as files and the database contains the paths to the pictures. The database consists of two tables: TABLE DATA ID Name LastName
5
10273
by: nicholas | last post by:
I would like to insert a new record in a Ms Access database and retrieve the newly created ID (autonumber). I would like to do it in VB.NET for an ASP.NET page. ( no asp) I found several examples on the net, but most of them just work with sql-server (@@indentity), or use just asp with includes etc. Hope someone can help me with a 'working' example...
3
11805
by: Phi | last post by:
Hi, I hope somebody could help me with this problem. I would like to make a form to add and delete records from my ms access database. I've found most of the codes from the internet and adjusted some part of it. Anyhow, inserting records to the database seems to work fine, but deleting the records is not working as I want to and I just can't see what's causing the problem.
11
1413
by: johnb41 | last post by:
I need to Add, delete, rename, etc columns in my Jet/Access database in my app. I know I can add columns for a dataset, and work with it, but as far as I know there is no way to push the added table to the original database via .NET. Is there something I'm missing from ADO.NET that allows this? Or do I have to use the SQL syntax for adding and editing columns?
0
891
by: Jon S via DotNetMonster.com | last post by:
Hi all, I've just posted a similar post but I would be happy in just finding the below out. How would I assign a password to an already existing access database using (preferbly) C# or (rather than) ADO.NET? Thanks in advance.
7
2217
by: kowndinya | last post by:
Hello, i have developed a small program in VB 6.0 and the backend is MS ACCESS. i want to know who is currently logged ms access database. Some body accessing this database by using my program which is located in a local server. some times i need to modify the database. Hence i need to open ms access exclusively for me. But i am unable to open it. it was locked by some other user. if i know that user name, i can ask him to exit the program....
3
2693
by: mysore | last post by:
Hello, I have several textboxes on my VB6.0 form.I am using textboxes one for each field. I have Placed adocontrol on my form to connect to MS access database. The connectivity is fine. I have problem adding new record and inserting records to the database. For eg. I have a Insert button. Private Sub Insert_Click() Adodc1.Recordset.AddNew Adodc1.Recordset.Fields("First Name") = Form1.Text2.Text Adodc1.Recordset.Fields("CaseNo") =...
2
5781
by: chamali | last post by:
Hi guys, I have created database using ms access & i have ceated a form using vb.net. i want to do this. when i enter the data to the form & after that click Submit button the data must be enter in to the database. Please tell me how to do that. If you can tell me the coding. Thanks a lot
6
6208
by: Mark | last post by:
Currently using MS Access 2000 and SQL Server Express. Using the current DAO OpenRecordset code listed below, however I keep getting the error message.... 3254: ODBC --Cannot lock all records The code below runs in a MS Access frontend while the table is linked using an ODBC connected to an SQL Server (backend). The table (located in SQL) only has one row and one column within it . I want to try and stop any other request (other...
14
4623
by: SimeonD | last post by:
Hi I have an access database called Sales.Mdb In vb.net 2005, I'd like to open it. Which I can do. What I can't figure out is how to figure out if Sales.Mdb is open already. If so, I want to open that instance. Any ideas how I would do this? Thanks
0
7977
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7894
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8276
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8044
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8261
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6705
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3936
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1496
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.