HELP - Double click a field to open up a sub-form (1 Viewer)

Tim Johnson

New member
Local time
Today, 11:30
Joined
Feb 15, 2000
Messages
8
I have a form (frmCASEFILE) based on a main table (tblCASEFILE) that tracks criminal cases and generates Case Numbers with AutoNum.

When I am working on the form frmCASEFILE associated with tblCASEFILE I want to be able to double click on the Case Number Field in frmCASEFILE to open up a sub-form called frmCASECHARGES (frmCASECHARGES is associated with a query of tables tblCASEFILE and tblCASECHARGES, there can be many charges against a Case Number thus a one-to-many) and have the Case Number from frmCASEFILE appear in the Case Number field on the sub-form frmCASECHARGES so I can enter charges against the specific Case Number.

So far I when I double click on the Case Number field in frmCASEFILE I am then prompted for the Case Number even though it is in the field already. When I manually enter the Case Number the sub-form frmCASECHARGES opens up and displays the correct Case Number and corresponding info.

Here is the code I am using.

Private Sub txtCaseNumber_DblClick(Cancel As Integer)

Dim temp As String

temp = txtCaseNumber.Value
DoCmd.OpenForm "CHARGES", , , _
"tblCASECHARGES.CASENUM = temp"

End Sub

When I put in breakpoints and check the value of temp it is correct but after that step I don't know what's happening.

Any help would be greatly appreciated

Thank you,

Tim Johnson
 

Axis

Registered User.
Local time
Today, 11:30
Joined
Feb 3, 2000
Messages
74
If Case Numbers is an AutoNumber, then it is not a text field. Try "dim temp as Variant" instead.
 

Users who are viewing this thread

Top Bottom