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

List Box not storing value

Status
Not open for further replies.

tubbers

Technical User
Jun 23, 2004
198
US
I hope someone is able to make sense of this as I've been completely stumped.

I'm using Access 2003 database, Windows XP.

I have a form called Switchboard and it has a tab control on it. One of the tabs is called Search and another is called Browse.

On the Browse tab, the user enters in their criteria to browse for questions in the database, selects a record to view and clicks the Browse command button. Another form is opened up which displays all the necessary information. There is a list box on this form (D_ctlRM) which is populated with a internet address where the data originated from.

When you double click the item in the list box, it opens the appropriate web page. This works perfectly if you are browsing information.

The Search tab opens the exact same form with a different record source but when you double click an address in the D_ctlRM control, it can't find the control's value (i.e. won't populate the shtml variable)

I'm at a complete loss as to why it works in one situation but not in the next.

Any ideas?

Code:
Private Sub D_ctlRM_DblClick(Cancel As Integer)
    
Dim shtml As Integer
    
    shtml = Me.D_ctlRM.Value
    
        sWeb = DLookup("RM_Loc", "Resource", "RM_ID = " & shtml)
        
        Application.FollowHyperlink sWeb, , False
        
End Sub

D_ctlRM is populated on the On Current event
Code:
Me.D_ctlRM.RowSourceType = "Table/Query"
Me.D_ctlRM.RowSource = "SELECT Resource.RM_ID, Resource.RM_Loc FROM Resource INNER JOIN L_DQ_RM ON Resource.RM_ID=L_DQ_RM.RM_ID WHERE (((L_DQ_RM.DQ_ID)=Forms![Search or Browse]!Detail_ctlDQID)) ORDER BY Resource.RM_Desc; "

RM_Loc is a memo field
RM_ID is an autonumber

The only difference I can see is that when users Search, the form is populated with more than one record. When users Browse, they select a specific record to view. Could that be the issue?

I've got another form which has the same sort of list box to launch an internet page. This form has multiple records and the list box value is populated on every record and you can open the internet pages without problem.

 
Hi!

Is the list box in the form that isn't working set to multiselect? If so then the .Value for the list box will always be null.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
No, it is set to None since I only want users to be able to open one document at a time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top