Insert CLientID into popup form

D

dbalorenzini

I have a main form (frmClientDetail) on which there is a dropdown list
(cboStatus). What I need is to be able to open a pop form (frmWithdrawl) in
add mode if they change cboStatus to "Inactive". I am not sure how to write
the openform statement linked to the appropriate frmClientDetail record in
add mode. I am thinking something along the lines of this:

sub cbo_status_afterupdat()
Dim sWHere as string

If cboStatus = "Inactive" then
Openform frmWithdrawal, stWhere, addmode
End if

Also how would I define the sWhere string the contains the join information.
in this case it would be

frmClientDetail.ID = frmWithdrawl.ClientID

another thing, is the clientid in the frmWithdrawal is not the PK to the
table. It has a column called ID (autonumber) that is the PK. THis is the
code I have so far:

If Me.Status = "Inactive" Then
iClientID = Me.ID

'DoCmd.OpenForm "frmClientWithdraw", wherecondition:="ClientID=" &
Me.ClientID = Forms!frmClientDetail![ID], DataMode:=acFormAdd
' DoCmd.OpenForm "frmClientWithdraw", acNormal, , , acFormAdd, ,
[ClientID] = iClientID
DoCmd.OpenForm "frmClientWithdraw", , , , acFormAdd, acWindowNormal, Me.ID



End If
 
D

Damon Heron

How about:

Dim strWhere As String
strWhere = "ClientID =" & me.ID
DoCmd.openform "frmWithdrawal", , , strWhere

That should open all instances of the withdrawal form where the current ID
is the same as the foreign ClientID.

Damon
 

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