UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Form Prompts For A Parameter, Access 2013    
 
   
dflak
post Nov 22 2017, 01:04 PM
Post#1


Utter Access VIP
Posts: 6,245
Joined: 22-June 04
From: North Carolina


Slogging along on my training database.

I launch frm_lk_exercise and I click on the Edit Button. I am expecting that it launch frm_exrecise_roster for the selected exercise number. Instead, I get a prompt for tbl_exercise!exe_FK_exercise. If I fill in the prompt manually with a 1 or 2, it brings up a blank form instead of the form associated with the exercise number.

I've stared at it all morning and still haven't got an idea of why it's not launching properly.

CODE
Private Sub But_Edit_Click()
DoCmd.OpenForm "frm_exercise_roster", acNormal, "", _
    "[Forms]![frm_lk_exercise]![lk_exe_ID]=[tbl_exercise]![exe_FK_exercise]", _
    acEdit, acNormal
End Sub

Attached File(s)
Attached File  Unit_Training.zip ( 312.55K )Number of downloads: 8
 
Go to the top of the page
 
DanielPineault
post Nov 22 2017, 01:09 PM
Post#2


UtterAccess VIP
Posts: 6,273
Joined: 30-June 11



I think you want

CODE
Private Sub But_Edit_Click()
    On Error GoTo Error_Handler

    DoCmd.OpenForm "frm_exercise_roster", acNormal, , "[lk_exe_ID]=" & Me.lk_exe_ID, acEdit, acNormal

Error_Handler_Exit:
    On Error Resume Next
    Exit Sub

Error_Handler:
    MsgBox "The following error has occured" & vbCrLf & vbCrLf & _
           "Error Number: " & Err.Number & vbCrLf & _
           "Error Source: But_Edit_Click" & vbCrLf & _
           "Error Description: " & Err.Description & _
           Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
           , vbOKOnly + vbCritical, "An Error has Occured!"
    Resume Error_Handler_Exit
End Sub
Go to the top of the page
 
dflak
post Nov 22 2017, 01:21 PM
Post#3


Utter Access VIP
Posts: 6,245
Joined: 22-June 04
From: North Carolina


Thanks. I was just sniffing at that tree when you came up with the answer - I'm *not* trying to go cross-table here. Yes, the code works just fine.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    11th December 2018 - 08:50 PM