David,
You should learn how to do some trouble-shooting. You can use Debug.Print and breakpoints to figure out on your own what's going on. If you need assistance in how to use these, check this link http://www.tek-tips.com/faqs.cfm?fid=7148.
Regards,
Duane
Sent: Monday, February 13, 2017 12:52 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] VBA for Add New Record on 2-Click
If Me.OpenArgs & "" <> "" Then
Me.cboProjectID.DefaultValue = Me.OpenArgs
Me.cboProjectID.Requery
txtSegmentNumber.SetFocus
End If
End Sub
---In MS_Access_Professionals@yahoogroups.com, <duanehookom@...> wrote :
David,
I would expect code in the OnOpen like:
If Me.OpenArgs & "" <> "" Then 'make sure there is OpenArgs
Me.[some control name].DefaultValue = Me.OpenArgs
End If
Regards,
Duane
Sent: Monday, February 13, 2017 7:00 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] VBA for Add New Record on 2-Click
'
---In MS_Access_Professionals@yahoogroups.com, <duanehookom@...> wrote :
David,
Congrats and exploring and trying something new!
If you open a form acDialog, the code will stop running until the form frmSegmentsAndFeatures is closed.
Since you seem to be comfortable with research on your own, check out "OpenArgs" which allows you to send values to the form being opened. Send the values you want to set and then have code in the On Open event of frmSegmentsAndFeatures which sets the default values of the controls.
Regards,
Duane
Sent: Sunday, February 12, 2017 11:10 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] VBA for Add New Record on 2-Click
On Error GoTo lstProjectSegments_Click_Err
DoCmd.OpenForm "frmSegmentsAndFeatures", acNormal, , , acFormAdd, acDialog
Forms!frmSegmentsAndFeatures.cboProjectID = Forms!frmMainProjMgr.cboSelectProjectID
Forms!frmSegmentsAndFeatures!txtSegmentNumber.SetFocus
If (Error <> 0) Then
Beep
MsgBox Error.Description, vbOKOnly, ""
End If
lstProjectSegments_Click_Exit:
Exit Sub
MsgBox Error$
Resume lstProjectSegments_Click_Exit
End Sub
Posted by: Duane Hookom <duanehookom@hotmail.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (9) |
Tidak ada komentar:
Posting Komentar