Subform button not getting correct record

C

Chris

My master form (client) has a subform (jobs summary) which is continuous.

I have a button beside the record to pull up the details (on popup form -
JobDetails) for a user-selected job viewed on the continuous subform (Jobs
summary). The button wizard is unavailable because of continuous form, I
think.

I am able to open the popup form, but even though the subform shows only the
viewed clients records, the popup shows all records all clients.

I have attempted DoCmd.open form with the job number link criteria to no
avail.
My job number is currency type (advised so way back).

My attempts include:
stLinkCriteria = "[InvNum]=" & "" & Me![InvNum] & ""

stLinkCriteria = "[ClientID]='" & Me!ClientID & "' and [InvNum]= '" & _
Me!InvNum & "'"

stLinkCriteria = "[InvNum]=" & Me![InvNum]

stLinkCriteria = "[ClientID]='" & Me!txtClientID & "' and [InvNum]= ' & _
Me!txtInvNum & '"

As you can tell, I'm not sure what I'm doing.

Please help?
 
B

Beetle

I can't imagine why you would want your job number to be a currency data
type, but maybe that's a matter for another thread.

How are your Jobs table and your Job Details table linked?. Is it by the
InvNum field or some other field?
 
C

Chris

Thanks for the reply.

The client form and jobs summary (continuous) subform are linked by ClientID.

I am attempting to pull up a popup form with the details. Thus, the link to
that form is where I am stalled.

The subform (continuous summary) and the popup (details) are datasourced to
the same query. Both ClientID and InvNum are present in the query, in the
subform and in the details form.

I was advised several years ago (here) to use the currency format for some
situation that existed then and may not. But I won't change it needlessly.

Does this help you help me?
--
Thanks for your help,
Chris


Beetle said:
I can't imagine why you would want your job number to be a currency data
type, but maybe that's a matter for another thread.

How are your Jobs table and your Job Details table linked?. Is it by the
InvNum field or some other field?
--
_________

Sean Bailey


Chris said:
My master form (client) has a subform (jobs summary) which is continuous.

I have a button beside the record to pull up the details (on popup form -
JobDetails) for a user-selected job viewed on the continuous subform (Jobs
summary). The button wizard is unavailable because of continuous form, I
think.

I am able to open the popup form, but even though the subform shows only the
viewed clients records, the popup shows all records all clients.

I have attempted DoCmd.open form with the job number link criteria to no
avail.
My job number is currency type (advised so way back).

My attempts include:
stLinkCriteria = "[InvNum]=" & "" & Me![InvNum] & ""

stLinkCriteria = "[ClientID]='" & Me!ClientID & "' and [InvNum]= '" & _
Me!InvNum & "'"

stLinkCriteria = "[InvNum]=" & Me![InvNum]

stLinkCriteria = "[ClientID]='" & Me!txtClientID & "' and [InvNum]= ' & _
Me!txtInvNum & '"

As you can tell, I'm not sure what I'm doing.

Please help?
 
B

Beetle

You shouldn't need ClientID in the Job Details popup form, just InvNum
(assuming That's the PK of Job Summary). The code in the OnClick event for
your button should look something like;

Dim strDocName As String
Dim strLinkCriteria As String

strDocName = "JobDetails"
strLinkCriteria = "[InvNum]=" & Me![InvNum]

DoCmd.OpenForm strDocName, , , strLinkCriteria

--
_________

Sean Bailey


Chris said:
Thanks for the reply.

The client form and jobs summary (continuous) subform are linked by ClientID.

I am attempting to pull up a popup form with the details. Thus, the link to
that form is where I am stalled.

The subform (continuous summary) and the popup (details) are datasourced to
the same query. Both ClientID and InvNum are present in the query, in the
subform and in the details form.

I was advised several years ago (here) to use the currency format for some
situation that existed then and may not. But I won't change it needlessly.

Does this help you help me?
--
Thanks for your help,
Chris


Beetle said:
I can't imagine why you would want your job number to be a currency data
type, but maybe that's a matter for another thread.

How are your Jobs table and your Job Details table linked?. Is it by the
InvNum field or some other field?
--
_________

Sean Bailey


Chris said:
My master form (client) has a subform (jobs summary) which is continuous.

I have a button beside the record to pull up the details (on popup form -
JobDetails) for a user-selected job viewed on the continuous subform (Jobs
summary). The button wizard is unavailable because of continuous form, I
think.

I am able to open the popup form, but even though the subform shows only the
viewed clients records, the popup shows all records all clients.

I have attempted DoCmd.open form with the job number link criteria to no
avail.
My job number is currency type (advised so way back).

My attempts include:
stLinkCriteria = "[InvNum]=" & "" & Me![InvNum] & ""

stLinkCriteria = "[ClientID]='" & Me!ClientID & "' and [InvNum]= '" & _
Me!InvNum & "'"

stLinkCriteria = "[InvNum]=" & Me![InvNum]

stLinkCriteria = "[ClientID]='" & Me!txtClientID & "' and [InvNum]= ' & _
Me!txtInvNum & '"

As you can tell, I'm not sure what I'm doing.

Please help?
 
C

Chris

That was my first unsuccessful attempt. I use that often.

That code does open the form, but displays all the records in the table.

It does not select only those records for the client of the parent (to the
subform JobSummary, continuous) form.

Any other suggestions? Anyone?

--
Thanks for your help,
Chrissy


Beetle said:
You shouldn't need ClientID in the Job Details popup form, just InvNum
(assuming That's the PK of Job Summary). The code in the OnClick event for
your button should look something like;

Dim strDocName As String
Dim strLinkCriteria As String

strDocName = "JobDetails"
strLinkCriteria = "[InvNum]=" & Me![InvNum]

DoCmd.OpenForm strDocName, , , strLinkCriteria

--
_________

Sean Bailey


Chris said:
Thanks for the reply.

The client form and jobs summary (continuous) subform are linked by ClientID.

I am attempting to pull up a popup form with the details. Thus, the link to
that form is where I am stalled.

The subform (continuous summary) and the popup (details) are datasourced to
the same query. Both ClientID and InvNum are present in the query, in the
subform and in the details form.

I was advised several years ago (here) to use the currency format for some
situation that existed then and may not. But I won't change it needlessly.

Does this help you help me?
--
Thanks for your help,
Chris


Beetle said:
I can't imagine why you would want your job number to be a currency data
type, but maybe that's a matter for another thread.

How are your Jobs table and your Job Details table linked?. Is it by the
InvNum field or some other field?
--
_________

Sean Bailey


:

My master form (client) has a subform (jobs summary) which is continuous.

I have a button beside the record to pull up the details (on popup form -
JobDetails) for a user-selected job viewed on the continuous subform (Jobs
summary). The button wizard is unavailable because of continuous form, I
think.

I am able to open the popup form, but even though the subform shows only the
viewed clients records, the popup shows all records all clients.

I have attempted DoCmd.open form with the job number link criteria to no
avail.
My job number is currency type (advised so way back).

My attempts include:
stLinkCriteria = "[InvNum]=" & "" & Me![InvNum] & ""

stLinkCriteria = "[ClientID]='" & Me!ClientID & "' and [InvNum]= '" & _
Me!InvNum & "'"

stLinkCriteria = "[InvNum]=" & Me![InvNum]

stLinkCriteria = "[ClientID]='" & Me!txtClientID & "' and [InvNum]= ' & _
Me!txtInvNum & '"

As you can tell, I'm not sure what I'm doing.

Please help?
 

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

Top