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 / Forms Programming / March 2007

Tip: Looking for answers? Try searching our database.

Add and modify without exit the form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Moff - 22 Mar 2007 13:53 GMT
Hi,
I want to know if it is possible to add a film number in a record, and
without exit the form, switch in modify mode to add data in other tables such
actors that are in this particular film. If it's possible, how can I do it ?
I'll be happy even if you have only a general answer.
Thanks.
Arvin Meyer [MVP] - 22 Mar 2007 14:11 GMT
If there is a relationship between the underlying tables, you may be able to
build a subform to add the data to subsequent tables, if not, you can
probably built a recordset and use AddNew. Here's some aircode:

Sub cmdAdd_Click()
On Error GoTo Error_Handler

Dim db As DAO.Database
Dim rst As DAO.Recordset

Set db = CurrentDb
Set rst = db.OpenRecordset("tblNameHere", , dbAppendOnly)

With rst
   .AddNew
   !ActorName= Me.txtActorName
   !OtherField = Me.txtOtherData
   .Update
   .Close
End With

Exit_Here:
rst.Close
Set rst = Nothing
Set db = Nothing

Error_Handler:
   MsgBox Err.Number & ": " & Err.Description
   Resume Exit_Here
End Sub
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

> Hi,
> I want to know if it is possible to add a film number in a record, and
[quoted text clipped - 4 lines]
> I'll be happy even if you have only a general answer.
> Thanks.
Moff - 22 Mar 2007 14:38 GMT
There is relationship with other tables. The problem is that I can't update
the data in other tables (such actors) because the record containing the film
number (the field in relation) must be added to the film table before. This
is where I'm stuck.
Powderfinger - 22 Mar 2007 14:17 GMT
> Hi,
> I want to know if it is possible to add a film number in a record, and
> without exit the form, switch in modify mode to add data in other tables such
> actors that are in this particular film. If it's possible, how can I do it ?
> I'll be happy even if you have only a general answer.
> Thanks.

Sure. These things are normally accomplished using subforms.

You would first create a form whose Data Source is the film table. Then
create another form whose Data Source is the actor table. Finally, open up
the Film form in design view  and add the Actor form into it as a sub form.
Moff - 22 Mar 2007 15:05 GMT
Thanks PowderFinger. That's already done.
Moff - 22 Mar 2007 16:32 GMT
To simplify, I  want to add a film number in a record, and without exit the
form, switch in modify mode to modify other fields of this record. Is it
possible ?
Arvin Meyer [MVP] - 23 Mar 2007 03:55 GMT
> To simplify, I  want to add a film number in a record, and without exit
> the
> form, switch in modify mode to modify other fields of this record. Is it
> possible ?

Yes. You can do it with the NotInList event of a combo box. You can also so
it with unbound forms. The code I wrote in the earlier post will also work
with unbound an form.
Signature

Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

 
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.