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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo Box event procedure... I can't get it to open form on click

Status
Not open for further replies.

DebiV

Programmer
Apr 29, 2013
7
US
I want this to open the form for the selection on in the combo box... I have not programmed in Access for many years :(

Dim stDocName As String
stLinkCriteria = Me.Search_Location

stDocName = "frmLocationLookup"

DoCmd.OpenForm stDocName, acNormal = "[Tenant Name]=" & "'" & [Tenant Name] & "'", , Normal
 
When in the VBE, put the cursor inside the OpenForm word and press the F1 key.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I got it to open the form but not to the specific records :-/
 
It is not opening to the specific record... it is opening the correct form.

DoCmd.OpenForm stDocName, acNormal, "Tenant Name= '" & Me.Search_Location & "', acFormEdit, acWindowNormal
 
As stated the help file shows
expression .OpenForm(FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs)

first parameter: form name
2nd: View
3rd: Name of Filter or query
4th: Where condition
5th: data mode
6th: Window mode
7th: OpenArg

DoCmd.OpenForm stDocName, acNormal, "Tenant Name= '" & Me.Search_Location & "', acFormEdit, acWindowNormal"

So your where statement should be your 4th parameter not the 3rd
DoCmd.OpenForm stDocName, acNormal, ,"Tenant Name= '" & Me.Search_Location & "', acFormEdit, acWindowNormal"
 
I think MajP meant to move the last double quote further to the left:

Code:
DoCmd.OpenForm stDocName, acNormal, ,"Tenant Name= '" & Me.Search_Location & "'[COLOR=#A40000][highlight #FCE94F]"[/highlight][/color], acFormEdit, acWindowNormal

Duane
Hook'D on Access
MS Access MVP
 
No, I did not even notice that. What I noticed was that the where condition is in the 3rd argument which is the Filter paramter. It should be the 4th argument which is the WhereCondition. I added a comma after acnormal.
 
thx... I forgot how sensitive Access fields are to using a space in the field name. the little things that make you go ... ugh!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top