Build macro that goes to the TODO form and opens a new record

Dinictus

Registered User.
Local time
Today, 18:06
Joined
Nov 30, 2004
Messages
22
Hi,

I have a simple dbase with customer name and a level 2 todo table. (so 1 customer can have more that 1 todo. Now in certain circumstances I want acces to automatically ask if the user wants to create a todo. And on "yes" I want access to go to the todo form and open a new record.

I've been working with the openform, and gotorecord functions but somehow I can't get it to open a NEW record . When no record excists it makes one but it doen not do it fot the particular customur you are in...

Can anyone help me out? I know it can be done. Just have to find it.

Thnanks.
 
Try opening your form using the following:-

DoCmd.OpenForm "EnterFormNameHere", acNormal, , , acFormAdd
 
I get the above to trigger as an event.

The problem is as follows: The todo form opens, I add a record but now the newly added todo is not in relation to the customer I am in! It is in the todo table but doens't have a customer name. IS this a problem I have with a relation? It workt whrn I just add a todo in my mainform (where todo is a datasheet form in my main form)

The relation between the cusomer and todo is a one to many with refeerential integrity and all cascades. IT should be right not?


By theway, I want to trigger the event it when, for example, a complaint is registerred and you exit the complaint record. How can I do that?

Thnks man!
 
Last edited:
Probably the easiest way to do this is to have a main form for the customers and a subform based on the todo table. If you set the link master/child fields correctly you will have the todo's attached to the customer. And it is easy to ad, delete or change a todo in the subform.

Not sure what you have in mind concerning automatically asking, where and when do you want that to happen?
 
Yes I will just lead someone to the subform and let them add,close or change it in this form. but what I want is that access askes if someone want to create a todo (and then goto the subform) when you exit another table (via a form)

So, I create an order in the Order table then on exiting this order table, I get the question: "Do you want to create a todo for this event?" on no, it just quits, on yes it goed to the todo subform.

mzz, I must be able to do this.
 
ToDo

You could put the following code in the AfterUpdate Event of the form.
It pops up a message box on closing the form.
If user selects "yes" it will open a form, else just close the current form

Private Sub Form_AfterUpdate()

Dim strMsg As String
strMsg = "Do you want to create a ToDo"
If MsgBox(strMsg, vbYesNo, "") = vbYes Then
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "yourform"
DoCmd.OpenForm stDocName
Else
End If

End Sub

The following link may be useful to you.
There is a sample database called Subform Reference , it demonstrates how to set focus on controls on subforms and subforms as well as retrieve values from subforms and subsubforms..

http://www.candace-tripp.com/_pages/access_downloads.asp

Good Luck
 

Users who are viewing this thread

Back
Top Bottom