Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / August 2004

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Crispywafers - 31 Aug 2004 14:22 GMT
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
G.J. v.d. Kamp - 31 Aug 2004 22:33 GMT
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

> Hi all,
>
[quoted text clipped - 41 lines]
>
> Abby
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.