Opening Arguments

R

Ripper

I am using the following code to open a form with the opening arguments, but
the opening form does not populate with the LocID from the subform I just
clicked. Can anyone spot an error?

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmDisciplineAdd-D-Hall"
stLinkCriteria = "[LocID] =" & Me.[LocID]

DoCmd.OpenForm stDocName, acNormal, , , acFormAdd, , stLinkCriteria

The new form will have it's LocID filled in and then all the teacher nees to
do is click the X to close and add the record. Please help.
 
D

Douglas J. Steele

By itself, passing opening arguments does nothing. You need to put code in
frmDisciplineAdd-D-Hall to recognize that something was passed, and to do
something with it.

Try something like:

Private Sub Form_Load()

If IsNull(Me.OpenArgs) = False Then
Me.LocID = Mid$(Me.OpenArgs, InStr(Me.OpenArgs, "=") + 1
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top