My Assistant
![]() ![]() |
|
|
Apr 17 2012, 04:33 AM
Post
#1
|
|
|
New Member Posts: 16 |
Hi, I am trying to load a form to display specific data from a combo list box. It loads the form but not displaying the data. The code I am using is:
Private Sub Command4_Click() On Error GoTo Err_Command4_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "Main Details" stLinkCriteria = "[Last Name]=" & "'" & Me![Combo0] & "'" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_Command4_Click: Exit Sub Err_Command4_Click: MsgBox Err.Description Resume Exit_Command4_Click End Sub Any help is appreciated. |
|
|
|
Apr 17 2012, 04:53 AM
Post
#2
|
|
|
UtterAccess VIP Posts: 1,097 From: Zagreb - Croatia |
Try this:
stLinkCriteria = "[Last Name]='" & Me![Combo0] & "'" |
|
|
|
Apr 17 2012, 04:57 AM
Post
#3
|
|
|
New Member Posts: 16 |
Just tried it and it does the same as the code I am using by loading the form but without the data lookup
|
|
|
|
Apr 17 2012, 05:41 AM
Post
#4
|
|
|
Utterly Eccentric and Moderator Posts: 3,660 From: Bristol / Ipswich / Spain |
Its possible that your combo box has a first, hidden column and your link is referring to that column. Have a look at this link Columns problem You might try this also:
Dim stLinkCriteria As String Dim strLastName as String stDocName = "Main Details" strLastName = Me.Combo0.Column(1) 'IF it is Column 1....column count starts at 0 stLinkCriteria = "[Last Name]=" & strLastName DoCmd.OpenForm stDocName, , , stLinkCriteria HTH Z |
|
|
|
Apr 17 2012, 06:22 AM
Post
#5
|
|
|
UtterAccess VIP Posts: 1,097 From: Zagreb - Croatia |
Send a short example of your MDB, (Access 2000 or 2002-2003).
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 18th May 2013 - 06:12 AM |