mutantstar
09-12-2001, 09:48 AM
Hello,
I have two listboxes. When you click in the source listbox, the value is moved to the destination listbox and is removed from the source listbox. As well, when you click in the destination listbox, the value is moved back to the source listbox.
My problem is, for the most part the following code is working for me, but every so often the listboxes are not refreshing and even less occasionally the value will not move from the destination back to the source. I find it difficult to troubleshoot this problem because it is so sporadic and is producing no error messages. It just won't work at times.
Another thing I should explain is that the following form is being packaged and used with the Run-time version of Access 2000. The problem occurs most frequently in the Run-time environment, but I have run across the problem on my development machine (running full version of Access 2000).
Please help!!! http://www.access-programmers.co.uk/ubb/smile.gif
--------------
Option Compare Database
Option Explicit
Private Sub destination(finishcode As String, Category As String, materialcode As String, mcategory As String)
Dim CurDB As DAO.Database, rst As DAO.Recordset
Set CurDB = DBEngine.Workspaces(0).Databases(0)
Set rst = CurDB.OpenRecordset("SELECT * FROM finishes WHERE project = '" & globalProject() & "' AND roomid = " & globalRoomid() & _
" AND finishcode = '" & finishcode & "' AND category = '" & Category & "' AND mcategory = '" & mcategory & "' AND materialcode = '" & materialcode & "';", dbOpenDynaset)
rst.Delete
rst.Close
End Sub
Private Sub source(finishcode As String, Category As String, materialcode, mcategory As String)
Dim CurDB As DAO.Database, rst As DAO.Recordset
Set CurDB = DBEngine.Workspaces(0).Databases(0)
Set rst = CurDB.OpenRecordset("finishes", dbOpenDynaset)
With rst
.AddNew
![roomid] = globalRoomid()
![project] = globalProject()
![finishcode] = finishcode
![Category] = Category
![materialcode] = materialcode
![mcategory] = mcategory
.Update
End With
rst.Close
End Sub
Private Sub ceildest_DblClick(Cancel As Integer)
Call destination(Me![ceildest], "G", "_", "C")
Me![ceildest].Requery
Me![ceilsource].Requery
End Sub
Private Sub ceilsource_DblClick(Cancel As Integer)
Call source(Me![ceilsource], "G", "_", "C")
Me![ceilsource].Requery
Me![ceildest].Requery
End Sub
I have two listboxes. When you click in the source listbox, the value is moved to the destination listbox and is removed from the source listbox. As well, when you click in the destination listbox, the value is moved back to the source listbox.
My problem is, for the most part the following code is working for me, but every so often the listboxes are not refreshing and even less occasionally the value will not move from the destination back to the source. I find it difficult to troubleshoot this problem because it is so sporadic and is producing no error messages. It just won't work at times.
Another thing I should explain is that the following form is being packaged and used with the Run-time version of Access 2000. The problem occurs most frequently in the Run-time environment, but I have run across the problem on my development machine (running full version of Access 2000).
Please help!!! http://www.access-programmers.co.uk/ubb/smile.gif
--------------
Option Compare Database
Option Explicit
Private Sub destination(finishcode As String, Category As String, materialcode As String, mcategory As String)
Dim CurDB As DAO.Database, rst As DAO.Recordset
Set CurDB = DBEngine.Workspaces(0).Databases(0)
Set rst = CurDB.OpenRecordset("SELECT * FROM finishes WHERE project = '" & globalProject() & "' AND roomid = " & globalRoomid() & _
" AND finishcode = '" & finishcode & "' AND category = '" & Category & "' AND mcategory = '" & mcategory & "' AND materialcode = '" & materialcode & "';", dbOpenDynaset)
rst.Delete
rst.Close
End Sub
Private Sub source(finishcode As String, Category As String, materialcode, mcategory As String)
Dim CurDB As DAO.Database, rst As DAO.Recordset
Set CurDB = DBEngine.Workspaces(0).Databases(0)
Set rst = CurDB.OpenRecordset("finishes", dbOpenDynaset)
With rst
.AddNew
![roomid] = globalRoomid()
![project] = globalProject()
![finishcode] = finishcode
![Category] = Category
![materialcode] = materialcode
![mcategory] = mcategory
.Update
End With
rst.Close
End Sub
Private Sub ceildest_DblClick(Cancel As Integer)
Call destination(Me![ceildest], "G", "_", "C")
Me![ceildest].Requery
Me![ceilsource].Requery
End Sub
Private Sub ceilsource_DblClick(Cancel As Integer)
Call source(Me![ceilsource], "G", "_", "C")
Me![ceilsource].Requery
Me![ceildest].Requery
End Sub