473,788 Members | 2,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

docmd.openform can't create new record

34 New Member
Hi all,

Have a question I can't get around. I've done this before and for some reason can't get it to work this time.

I'm opening a form through docmd.openform, and trying to get it to open an blank form to allow me to add a new record. Problem is, every time I run the method, it opens up the first record in the database, rather than give me a new emtpy record. Please help!!!!

I'm using:
DoCmd.OpenForm "frmComm", acNormal, , , acFormAdd

I always thought that "acFormAdd" would provide me with a new empty record, but it's not working. Could the problem be with the form that is being opened? I inactivated all code for the new form, so there are no methods working there, still doesn't work.

What am I doing wrong?

Robin
Dec 14 '07 #1
1 5002
RAG2007
34 New Member
Sorry, I think I realized the problem. The record source query that I was using was based on a table that didn't have a primary key defined. Once I defined the main table ID field as the primary key, it came together.

Hi all,

Have a question I can't get around. I've done this before and for some reason can't get it to work this time.

I'm opening a form through docmd.openform, and trying to get it to open an blank form to allow me to add a new record. Problem is, every time I run the method, it opens up the first record in the database, rather than give me a new emtpy record. Please help!!!!

I'm using:
DoCmd.OpenForm "frmComm", acNormal, , , acFormAdd

I always thought that "acFormAdd" would provide me with a new empty record, but it's not working. Could the problem be with the form that is being opened? I inactivated all code for the new form, so there are no methods working there, still doesn't work.

What am I doing wrong?

Robin
Dec 14 '07 #2

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

Similar topics

2
3307
by: chanchito_cojones | last post by:
hi there, I am needing some help with a database I am putting together. The database works off of a main Form, which then has buttons on it that will open up other forms. The problem I am having is that if I am updating any information on the current record, and then open one of the other forms, the new form will not show the updated information. I realize that a simple macro solves this problem by basically closing the first form,...
3
4520
by: Lyn | last post by:
Hi, I have a Search input form which collects from the user a person's name. I am using LIKE with a "%" suffix in the SQL so that the user does not have to type in the full name. When they hit the Search button, a query is run to search the Person table for a match. This produces a recordset (I am using ADO). If the RecordCount is zero, they get a No Match message. If the RecordCount is 1, a DoCmd.OpenForm is performed to open the...
15
3898
by: Thelma Lubkin | last post by:
formA determines some_where and some_value and issues docmd.close ,Me docmd.openform "formB", , ,some_where, , ,some_value formB receives the correct some_where and some_value After completing its work formB issues docmd.close ,Me docmd.openform "formA"
8
13213
by: John Welch | last post by:
I have a command button with the following code: DoCmd.OpenForm "frmSearchAssignments", , , "SearchAssignmentID = 1" (SearchAssignmentID is the PK, auto number) When it runs, the form opens but shows all records, rather than going to the one I want. If I look at the form in design view, it shows 'SearchAssignmentID=1' (without quotes) as the filter in the properties list. frmSearchAssignments is bound to a query qrySearchAssignments....
9
3522
by: keliie | last post by:
Hello (from Access novice), I'm building a switchboard form (using a Treeview object). The treeview is populated by two tables (tblSwitchboardParent and tblSwitchboardChild). Within tblSwitchboardChild, I have a string field called ChildArgument that contains string text of VBA code (e.g., DoCmd.OpenForm "myForm"). When users click on various portions of the Treeview object I want the Tree to either expand or open the report / form.
2
387
by: rturpyn | last post by:
I want to simply open a form, I don't want to limit the records returned. I'm using the code.... DoCmd.OpenForm "frm_GSG_Access_Rights", acFormDS, , When I enter something in the where ("Elist_Caption = 'GSG Model'") it does return my form with only 1 record. What am I missing? Thanks, -Turp
2
12875
by: mark mestrom | last post by:
hi, i have this problem with OpenForm and the stLinkCriteria. I have the following code: Private Sub Knop22_Click() On Error GoTo Err_Knop22_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "ALAHistorieEdit"
3
4894
martintallett
by: martintallett | last post by:
Help! I am trying to replace the Access Find button functionality on an old database. I can make it work when I use a basic form with bound fields and a button which shows a popup form which then finds the record the user wants then does a GoToRecord on the basic form. However... When I try to put this to work in the real world the form with the record context to GoToRecord is a subform and it only partially works.
1
2031
by: rdsandy | last post by:
Hi, I am using Access 2003. I have a list box on a form which has 6 columns in it, with data taken from a table. I have an unbound text box which holds the ID number for the selected item in the list box. I have a command button which I want to use to open another form on that record. At the moment it opens the other form but only to the first record. The other form has its recordset set to the same table as what the list box displays...
0
9656
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
10366
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
10175
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...
0
8993
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...
1
7518
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
6750
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
5399
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...
2
3675
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
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.