473,395 Members | 1,442 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.

Open form to new record (autonumber is generated) from another form

Hi all,

This seems like it would be fairly simple, but quite frankly I can't
figure it out. I have combed through other posts and still can't get
it working.

I have two tables (Students, Emergency Contacts) and two seperate main
entry forms for each table (frmNewStudent & frmEmergencyContacts). I
wanted to put a command button on frmNewStudent that when clicked
would open up frmEmergencyContacts to an add new record so that a user
can add a completly new emergency contact record to the Emergency
contact table.

I hope that makes sense.

I haven't been able to get it working. Code I'm currently using is
spitting back the error "Action or method requires a Form Name
argument". Code I have used previously has simply taken me to the
first record in the EmergencyContacts recordset. I just want the form
to ADD a record to EmergencyContacts.

Code in use:

Private Sub Command76_Click()

On Error GoTo Err_Command76_Click

DoCmd.OpenForm frmEmergencyContacts

DoCmd.GoToRecord , , acNewRec

Exit_Command76_Click:
Exit Sub

Err_Command76_Click:
MsgBox Err.Description
Resume Exit_Command76_Click

End Sub

---

Thanks for any help. I'm struggling.

Abby
Nov 13 '05 #1
1 5927
Put the name of the form between parentheses:

DoCmd.OpenForm "frmEmergencyContacts", acNormal, , , acFormAdd

The acFormAdd opens it at a new record, this would be little cleaner.

Regards,

GJ

cr**********@yahoo.com (Crispywafers) wrote in message news:<39**************************@posting.google. com>...
Hi all,

This seems like it would be fairly simple, but quite frankly I can't
figure it out. I have combed through other posts and still can't get
it working.

I have two tables (Students, Emergency Contacts) and two seperate main
entry forms for each table (frmNewStudent & frmEmergencyContacts). I
wanted to put a command button on frmNewStudent that when clicked
would open up frmEmergencyContacts to an add new record so that a user
can add a completly new emergency contact record to the Emergency
contact table.

I hope that makes sense.

I haven't been able to get it working. Code I'm currently using is
spitting back the error "Action or method requires a Form Name
argument". Code I have used previously has simply taken me to the
first record in the EmergencyContacts recordset. I just want the form
to ADD a record to EmergencyContacts.

Code in use:

Private Sub Command76_Click()

On Error GoTo Err_Command76_Click

DoCmd.OpenForm frmEmergencyContacts

DoCmd.GoToRecord , , acNewRec

Exit_Command76_Click:
Exit Sub

Err_Command76_Click:
MsgBox Err.Description
Resume Exit_Command76_Click

End Sub

---

Thanks for any help. I'm struggling.

Abby

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tim Marshall | last post by:
This is an embarrassing question to which I should know the answer, but I am not 100% sure of myself. My applications, whether they are Jet or Oracle usually deal with reporting on existing apps...
4
by: Don Seckler | last post by:
I am building an application to track the distribution and returns of copies of magazines. Copies of a magazine that are unsold are returned by the retailer to the wholesaler. They are...
5
by: Sami | last post by:
Please bear with me, and if you answer this question, please do it step by step. I am new at Access, not at all sophisticated. I am using Office XP. This will need to be read in Access for...
4
by: Mason | last post by:
This is probably an incredibly newbie-ish question. I just haven't had the cause to use many subforms before, so I'm pretty sure I just don't understand it correctly (even after reading up on it)....
6
by: CPAccess | last post by:
How do I maintain referential integrity between a main form and a subform, each based upon different (but joined with integrity enforced) table? Here's the situation: I have two tables:...
1
by: JHite | last post by:
I am using Access 2003. My Form has 4 fields: MailingListID, auto generated – primary key LastName FirstName NickName I used the Combo box wizard to set up look-up box on the form. I answered...
6
by: Markus_989 | last post by:
I have a LOANS table that has a list of loan details for different borrowers. I have a main switchboard with a LOANSELECT combo box (that displays a list of borrower last names and loan numbers)....
4
by: greg | last post by:
Hi, I don't think my message posted correctly so here it is. Is there any way to access the individual values of a form text box? I want to iterate through all of the rows and access the...
1
by: OxfordConsult | last post by:
Hello, I have created a form that links with a table with the autonumber feature as its primary key. Whenever i create a new record in the form (using a command button ... i have disabled the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
0
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,...
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
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...

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.