My Assistant
![]() ![]() |
|
|
Mar 8 2010, 10:40 AM
Post
#1
|
|
|
UtterAccess Addict Posts: 158 |
Hi
I have a continuous form where for each record on the form i have a button that says "Edit/View". The record source for this continuous form is a query that draws records from a table but has associated tables where some of the information is entered. In this example, it lists the obligations for both Contracts and Grants, but the actual background info on a contract or grant is stored in different tables and is entered via different forms. I would like the user to be able to go to the record in either the contract form or the grant form depending on what record they click on. I have been playing with an if then statement to do this. The problem is that when it executes it starts to tell me that i need to enter parameter values. I am not sure why the main contract or grant form is not recognizing the record and updating the subforms. . I believe it is flagging because of what is in the on open command in the contract or grant forms....which are merely requeries for lists and such. Here is the on open code for the grants form. The first flag i get is on the listtraining.requery DoCmd.GoToRecord , , acNewRec 'requery lists Forms!frm_grant.subfrm_grantyear.Form!ListYear.Requery Forms!frm_grant.subfrm_training.Form!ListTraining.Requery Forms!frm_grant.subfrm_notes.Form!ListNotes.Requery Forms!frm_grant!OAGPosition.Requery Forms!frm_grant!OAGOffice.Requery Forms!frm_grant!OAGPhone.Requery Forms!frm_grant!OAGFax.Requery Forms!frm_grant!OAGEmail.Requery Forms!frm_grant!OAGID.Requery 'enable/disable main form fields Me.Combo37.SetFocus Me.GrantNumber.Enabled = False Me.GrantStart.Enabled = False Me.GrantEnd.Enabled = False Me.StateID.Enabled = False Me.ProgramID.Enabled = False Me.Save.Enabled = False Me.New.Enabled = True Me.Get.Enabled = True Me.OAGID.Enabled = False Me.OAG_Save.Enabled = False Here is the code for my button on the continuous form. If [contractid]="0" Then Docmd.openform "frm_grant", acNormal,,"[grantid]=" & Me!GrantID Else Docmd.openform "frm_contract", acNormal,,"[contractid]=" & Me!ContractID End If |
|
|
|
Mar 8 2010, 12:39 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 4,236 From: Dayton, OH |
What is the data type for contractID and grantID
You have this If [contractid]="0" Then Docmd.openform "frm_grant", acNormal,,"[grantid]=" & Me!GrantID Else Docmd.openform "frm_contract", acNormal,,"[contractid]=" & Me!ContractID End If In the IF..THEN you have the zero in quotes which implies a text field but in the docmd for the frm_contract you have the contractID as numeric. |
|
|
|
Mar 8 2010, 01:44 PM
Post
#3
|
|
|
UtterAccess Addict Posts: 158 |
Datatype for the IDs is a number. Let me try changing that. Thanks.
What is the data type for contractID and grantID You have this If [contractid]="0" Then Docmd.openform "frm_grant", acNormal,,"[grantid]=" & Me!GrantID Else Docmd.openform "frm_contract", acNormal,,"[contractid]=" & Me!ContractID End If In the IF..THEN you have the zero in quotes which implies a text field but in the docmd for the frm_contract you have the contractID as numeric. |
|
|
|
Mar 8 2010, 03:06 PM
Post
#4
|
|
|
UtterAccess VIP Posts: 4,236 From: Dayton, OH |
Let us know how it works out
|
|
|
|
Mar 8 2010, 03:11 PM
Post
#5
|
|
|
UtterAccess Addict Posts: 158 |
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 25th May 2013 - 05:45 AM |