473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Making new records with VB

19
Hi there,

currently I am trying to get some basic experience with VB6
I was able to make a connection with MS Access already, so I made a form and made use of a ADO DC. Now I can see trough all of the records from that Table in the Database. Now am I trying to make it possible, to create new records using the Form in VB. So I made a Command button, tried some stuff and got stuck.. I have absolutely no clue on how to make a new form, that's why I am posting this here.

Thanks
~F3dde
Apr 10 '07 #1
6 2210
Hi there,

currently I am trying to get some basic experience with VB6
I was able to make a connection with MS Access already, so I made a form and made use of a ADO DC. Now I can see trough all of the records from that Table in the Database. Now am I trying to make it possible, to create new records using the Form in VB. So I made a Command button, tried some stuff and got stuck.. I have absolutely no clue on how to make a new form, that's why I am posting this here.

Thanks
~F3dde
would u Plz Describe in details.if possible show me the code also
Apr 10 '07 #2
Dököll
2,364 Expert 2GB
Hi there,

currently I am trying to get some basic experience with VB6
I was able to make a connection with MS Access already, so I made a form and made use of a ADO DC. Now I can see trough all of the records from that Table in the Database. Now am I trying to make it possible, to create new records using the Form in VB. So I made a Command button, tried some stuff and got stuck.. I have absolutely no clue on how to make a new form, that's why I am posting this here.

Thanks
~F3dde
Hey there, f3dde!

As mentioned, it's a bit unclear as to what you hope to achieve, but I seem to have picked up some hints. Sounds like you can see your database through ADODC but cannot add to your databse. If this is the case, I suggest you keep searching this forum. You may stumble upon notes on the very issue of adding/reading your data to/from database. Please let us know where you are, have a code added in this forum to have a look.

I wish you luck with the project.

In a bit!

Dököll
Apr 12 '07 #3
f3dde
19
Hey there, f3dde!

As mentioned, it's a bit unclear as to what you hope to achieve, but I seem to have picked up some hints. Sounds like you can see your database through ADODC but cannot add to your databse. If this is the case, I suggest you keep searching this forum. You may stumble upon notes on the very issue of adding/reading your data to/from database. Please let us know where you are, have a code added in this forum to have a look.

I wish you luck with the project.

In a bit!

Dököll

I am able to see my database trough the ADODC. It looks just like the form in Access now. I just want to be able to edit it in the VB form now, which I am not able to do yet. In other words. I'm trying to find out how to code the Command-buttons in order to make a new record. I hope this makes it more clear to you.
Apr 13 '07 #4
Dököll
2,364 Expert 2GB
I am able to see my database trough the ADODC. It looks just like the form in Access now. I just want to be able to edit it in the VB form now, which I am not able to do yet. In other words. I'm trying to find out how to code the Command-buttons in order to make a new record. I hope this makes it more clear to you.
You then will need to query your database, like an update statement. You're comfortable typing up a query!

The code you have to read your database can be modified to update...Post what you ahve working, we'll piece it together. How's that for a deal?
Apr 13 '07 #5
f3dde
19
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3. Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
  4. Adodc1.Caption = Adodc1.Recordset.AbsolutePosition & " van " & Adodc1.Recordset.RecordCount
  5. End Sub
  6.  
  7. Private Sub Form_Load()
  8.  Adodc1.Caption = Adodc1.Recordset.AbsolutePosition & " van " & Adodc1.Recordset.RecordCount
  9. End Sub
That is what I currently have, and I suppose this is what you meant. Hope you can help me
Apr 16 '07 #6
f3dde
19
Alright. Since I've had a critical error which made me delete the whole thing I had to start over again, and because I can't find a way to edit my post I made this new reply.

I had to edit my code, because I was unable to get it to work again using the code I posted earlier.

Currently my code looks like the following:
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2.  
  3. Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
  4. Adodc1.Caption = Adodc1.Recordset.AbsolutePosition & " van " & Adodc1.Recordset.RecordCount
  5. End Sub
  6.  
  7.  
  8. Private Sub Form_Load()
  9. Dim strVerbinding As String
  10.   strVerbinding = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\bibliotheek uitleensysteem.mdb"
  11.   With Adodc1
  12.    .ConnectionString = strVerbinding
  13.    .RecordSource = "SELECT * FROM Boek"
  14.    .Refresh
  15.   End With
  16.  
  17.   With txtID_Boek
  18.     Set .DataSource = Adodc1
  19.     .DataField = "ID_Boek"
  20.   End With
  21.   With txtISBN
  22.     Set .DataSource = Adodc1
  23.     .DataField = "ISBN"
  24.   End With
  25.   With txtAuteur
  26.     Set .DataSource = Adodc1
  27.     .DataField = "Auteur"
  28.   End With
  29.   With txtTitel
  30.     Set .DataSource = Adodc1
  31.     .DataField = "Titel"
  32.   End With
  33.   With txtRubriek
  34.     Set .DataSource = Adodc1
  35.     .DataField = "Rubriek"
  36.   End With
  37.   With txtUitleenbaar_in
  38.     Set .DataSource = Adodc1
  39.     .DataField = "Uitleenbaar in"
  40.   End With
  41.   End Sub
  42.  
This is pretty much the same thing exept for the ADO DC, which doesn't show me what I wanted.

Expand|Select|Wrap|Line Numbers
  1. Adodc1.Caption = Adodc1.Recordset.AbsolutePosition & " van " & Adodc1.Recordset.RecordCount
That is what I am using to show me where I am at the navigation. It should show me: "Current book" from "Total amount of books", but for some reason it doesn't refresh and so is behind all the time.

I'm also still trying to find a way to make new records true this form. By looking at some other help sites I've started to think I need to create a "Recordset", which also is a mystery for me.

I hope this update was clear for you, so you can help me.

~F3dde
Apr 16 '07 #7

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

Similar topics

1
by: Graheme | last post by:
Hi, couple of questions from a newbie: First, I have a database with basically 3 tables: Customer, which has cust#, name and address; Items which has cust#, type, serial# and description; Items...
4
by: N. Graves | last post by:
Hello... thank you for your time. I have a form that has a List box of equipotent records and a sub form that will show the data of the equipment select from the list box. Is it possible to...
2
by: uv | last post by:
Hi! I'm having problems submitting a new record through the form. I'm working with the wizard and I've added a control button to my form for entering entering a new record but for some reason it...
3
by: uv | last post by:
Hi! I'm having problems writing new records into the dtatabase as well as deleting. I have tried doing so by adding the control buttons to a form. Unfortunately I'm only succesful in creating the...
4
by: svdh2 | last post by:
Dear All, I have lately strugled more and more with Access, what started as a simple database has brought me to the fundaments of Access. I need to transfer fields from various tables to a...
3
by: Kenjamin.Lafayette | last post by:
Here is the scenario. I have a list of people, what building they work in, and on what days. Is there a way in access to pull up this database and have it make a list based only on the days,...
7
by: MarkNeumann | last post by:
I'm coming from a Corel paradox background and moving into an Access environment. So I'm struggling with something that I think is probably way simpler than I'm making it out to be. Access 2007...
2
by: Fred Ho | last post by:
I have a form with several text boxs ( for several fields of records information)hoping that user input at least one of the information to any of the field in the form and it will search the data...
1
by: Doug | last post by:
What is the simplest way to make a report where only the records where a field matches a certain date are included, and the user first selects that date (from form or popup)? (I can write the SQL...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
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,...

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.