473,889 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I can't add new record on a form

6 New Member
I can't add new record on a form, the add new record in navigation toolbar is disable on the form, but on properties I enable (addition,edit and delete)but still it's not working.

Please assist
Aug 8 '13
11 32103
jimatqsi
1,278 Recognized Expert Top Contributor
Tell us, what have you done to improve the situation? Others can learn from that.

Perhaps your problem comes from the fact that most of the text controls on your form are unbound; and some of the key fields from the structure table are not represented, not even with unbound fields. I don't see any code that moves values from these unbound controls to a recordset.

It would a very good idea for you to work through some examples given with Access; usually they're in an .mdb called Northwind, but I believe some versions have a different sample database.

I applaud your efforts, you're obviously expanding your programming boundaries, and you've come to the right place for help. But it would be a very idea to master some simpler forms and tables before tackling this one.

Jim
Aug 16 '13 #11
jimatqsi
1,278 Recognized Expert Top Contributor
medube1,
I'd like to point out a few critically important flaws with just one of your routines. Look at
Expand|Select|Wrap|Line Numbers
  1. Private Sub Combo32_AfterUpdate()
  2.     ' Find the record that matches the control.
  3.     Dim rs As Object
  4.  
  5.     Set rs = Me.Recordset.Clone
  6.     rs.FindFirst "[Section_ID] = " & Str(Nz(Me![Combo32], 0))
  7.     If Not rs.EOF Then Me.Bookmark = rs.Bookmark
  8. End Sub
  9.  
First off, it looks like you learned the lesson about bad names; there are no combo boxes in your form with this name. So maybe you renamed the combo box and did not realize that the code for that combo box did not get renamed.

You've opened a recordset rs but you never close it. That will bite you, I know from experience. Be sure to add
Expand|Select|Wrap|Line Numbers
  1. rs.close
  2. set rs = nothing
  3.  
after using a recordset.

And finally, you don't have any error trapping. You need to add that to most routines. Something like
Expand|Select|Wrap|Line Numbers
  1.     On Error GoTo Err_msg
  2.     .... your routine's other code here ....
  3.     exit sub (or function)
  4. Err_msg: msgbox "Error " & err.number & " " err.description
  5.          resume next
Search for vba error handling here in the forum or with Google and study that. There's a lot of good advice about that avaialable.

Jim
Aug 16 '13 #12

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

Similar topics

2
4718
by: EricRobineau | last post by:
hello I have a DB with many inter-related tables (MySQL) My main table called "content" has almost only foreign keys (integers) some have a 3 level relation (ex: content->city->region->country) I would like admins to be able to insert new records including all the "content" fields (in 1 page form) But how can I make an insert form that would display the related tables as list menus instead of a textfield with a number? (ex: select
5
1882
by: Rose | last post by:
I want to use the javascript dom to reference the field of a record in a multi-record html form when that field has been changed. How do I reference the field? I have a JavaScript function coded as: var zownerID = document.updOwners.ownerID.value var zownerName = document.updOwners.ownerName.value document.updOwners.mysql_update.value = zownerID document.updOwners.newName.value = zownerName I have tried calling it from onclick for...
1
1291
by: noname | last post by:
I have no clue where to start. Do I have another table of parts?
3
1762
by: Dan Williams | last post by:
Anyone know if i can take advantage of the datagrid features and use it in a vertical format to view and edit one record from a database? For example, Name: Address: Town: County:
6
6933
by: San | last post by:
Hey, I need to create a form with several text boxes in which users type in key words, press a command button on the form and it opens a matching record. Thanking you in advance.
2
1563
by: reidarT | last post by:
I have 3 fields in an aspx page. The 3. field should be the sum of field A and field B I use OnTextChanged to calculate the sum in field3. At the same time I want to insert the content of theese 3 fields into a row in a table. The problem is that I need 'postback is true' on the textfields to get an immediate calculation and then the insert action is triggered. reidarT
1
4803
by: alex.gruenther | last post by:
I am new to Access and need help creating an edit record form. I've got a table called Player with attributes like name, address, phone, etc. I've created an edit player form with a combo box that gets populated with a list of all the players (run from a lookupplayer query). When I select a user it gives the unique player ID. Now my problem, how do I take the unique ID to select that player's record to edit? The bottom part of the...
2
2529
by: guessvic | last post by:
Hello everyone, Does anyone know why after using the insert record function that Dreamweaver provides for ASP JavaScript page, then you CANNOT pass the value in the text field inside the form to another page?? Please help. Vic.
4
5552
by: Susan Bricker | last post by:
I have a form that displays record information in Continuous Record display (scrollable list). One of the fields in the record is an Integer value called "rcode" (reason code). But, I don't want to display the reason code integer value. I want to display the reason code descriptive text (string data). So I have a TEXT BOX object on the form to display the text. I have an public array defined(global variable defined in CommonProcs...
1
3540
by: Robert Ingles | last post by:
I have a situation where my users need to enter details about new laptops into a table via FRMCreateNewLaptopID - the FRMCreateNewLaptopID includes a UserID field to identify the primary user. They want to enter data into the UserID field in FRMCreateNewLaptopIDand click a confirmation button to see if the user does not exist then FRMCreateNewUserWhileBooking should open so they can enter the new user details which will be pushed to the...
0
9967
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
9810
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
10792
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
7998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7151
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5830
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4650
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4251
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3256
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.