Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on sub form navigation

Status
Not open for further replies.

ramrags

IS-IT--Management
Aug 17, 2001
62
US
On my database I have a form with a sub form and I'm Trying to stop the sub form from adding a new record
After entering the last field. Because of the settings on my tables you can not have two records with the
same patient id number. So I was trying on the after update event on the co pay field (witch is the last
field on the sub form) to go to a command button on the main form that saves and open a new record.
In the code I tried DoCmd.GoToControl Forms!frmREGISTRATION!cmdSaveNew,,,,with this I get the error
"An expression you entered is the wrong data type for one of the arguments. Can anyone tell me if this is
the right way to handle this or is there a better way to keep the sub form from adding a new record Thanks
for any help... Tom
 
Hi
if you NEVER want to be able to add a new record in the sub form why not set the AllowAdditions property of the form to False ?

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
No I can't do that because I want to be able to add one record that goes with the registration record. What I don't want it to do is go to a new record after you put in the info for the insurance that goes with that patient. The form opens for data entry. Tom
 
How are ya ramrags . . . .

[purple]Setting focus in Form/subForm is a little more involved.[/purple] For instance, too set the focus to a control on a subform, you have to drill down to it. First setting the focus to the subform(which is a control as far as the main form is concerned), then the control. Likewise you have to bring the focus back out to the main form first. Replace your code with the following:

Code:
[blue]Dim frm as Form
Set frm=Forms!YourMainFormName
frm.SetFocus
frm!YourButtonName.SetFocus
Set frm=Nothing[/blue]

cal.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top