RE: Change record source



You would make your life a lot easier if you would use a form/subform. The
Client should be the record source for the form and the Child the record
source for the subform.
--
Dave Hargis, Microsoft Access MVP


"Tara" wrote:

I have a form that I need to use in 2 different types of circumstances. In
one, it is used to add a child to the record of an existing client. In order
to get it to link correctly, I tried to use the following code:

Private Sub CommandAddChild_Click()
On Error GoTo Err_CommandAddChild_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmAddChild"

stLinkCriteria = "[CaseID]=" & Me![CaseID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_CommandAddChild_Click:
Exit Sub

Err_CommandAddChild_Click:
MsgBox Err.Description
Resume Exit_CommandAddChild_Click

End Sub

It doesn't work at all. I have no idea why not and I'd like to figure it
out. But, in the meantime, in order to just get it up and going, I decided
to go another route. I ended up setting the default value of CaseID on
frmAddChild to whatever the value of CaseID was on the previous form. In
this case it is: =[Forms]![frmClientCase]![CaseID] That setup works.
However it creates a problem when I try to use the form for the second
circumstance, because frmClientCase is not the form that is open when
frmAddChild is called, frmNEWClientCase is the open form. So, I guess what I
really need to do is figure out why the code I first tried to execute doesn't
work at all. If I get that figured out, I can use the same code in both of
the different circumstances.

Any help is greatly appreciated!



.



Relevant Pages

  • Re: Why is CoCreateInstance waiting forever?
    ... I have changed my object to both, and then it works fine with the client. ... >> ChildEBP RetAddr Args to Child ... Stack unwind information not available. ...
    (microsoft.public.win32.programmer.ole)
  • Re: newbie java design question
    ... Child C inherits from A. ... In a client, I want to determine which child implementation to use ... (via a config file, for instance). ...
    (comp.lang.java.programmer)
  • Re: [REPORT] cfs-v4 vs sd-0.44
    ... I think that during a fork, the parent has a higher probability of forking other processes than the child. ... Maybe a way to pass CPU time over a UNIX socket, along with information on what process/user passed it That would make it possible to really fix X properly on a local system. ... Ordinarily X would nice all of its client service threads to +10, but when a client passes CPU time to its thread over the socket, then its service thread temporarily gets the scheduling properties of the client. ...
    (Linux-Kernel)
  • Re: Passing a GUI handle to a socket and Postmessage back to GUI
    ... want to pass the handle (of one child) to a server socket class so it can post a message to the child window when data is received. ... In a sockets context it is extremely confusing to name CServer 'client'. ...
    (microsoft.public.vc.mfc)
  • Re: killking child processes
    ... us an application that is the server. ... The client issues some commands to the server, so it's a kind of a ... > process group) that affects your solution. ... >> unless the child process leaves the process group of the main process. ...
    (comp.unix.programmer)