Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Utilize 1 form for 'New Record' or 'Search Record' 1

Status
Not open for further replies.

JaredSangco

Technical User
Mar 5, 2008
78
US
Hi All,

I currently have a Main Interface form [frmMainInterface] that has:

1) A cmdButton that directs me to form [frmPartsInformation] which is basically a New record input form. The 'Data Entry' property is set to 'Yes'

and

2) A Parts List combo box that is used as a search criteria with a cmdbutton that directs me to form [frmPartsInformation_search]. The 'Data Entry' property is set to 'No'


Now both, [frmPartsInformation][/b/ and [frmPartsInformation_search] are basically the same form with the 'Data Entry' property being different.

Is there any way I can just utilize 1 form - [frmPartsInformation] and get rid of [frmPartsInformation_search]

The code behind the New Record button [cmdEnterNewPart] is

Code:
an embedded Macro that opens [frmPartsInformation]


The code behind my Search Button [cmdFindPart] on the 'On Click' event is

Code:
Private Sub cmdFindPart_Click()

On Error GoTo Err_cmdFindPart_Click

   Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmPartsInformation_search" 
    
    stLinkCriteria = "[PartName]=" & "'" & Me![Combo27] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Combo27 = Null 'clears list box selection

Exit_cmdFindPart_Click:
    Exit Sub

Err_cmdFindPart_Click:
    MsgBox Err.Description
    Resume Exit_cmdFindPart_Click

End Sub


Assistance is appreciated!
 
for search:
Code:
DoCmd.OpenForm "frmPartsInformation", , , "PartName='" & Me![Combo27] & "'"

for data entry:
Code:
DoCmd.OpenForm "frmPartsInformation", , , , acFormAdd

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top