Access 2000 requery problem

Results 1 to 2 of 2

Thread: Access 2000 requery problem

  1. #1
    Join Date
    Dec 1969

    Default Access 2000 requery problem

    I&#039;m dumping data into a table through a form and then requerying a list box on the form to <BR>display the data. The problem is listbox.Requery just doesn&#039;t work. <BR>The data is appending correctly, but I have to manually refresh the form (F9). What&#039;s <BR>really annoying is that if I step through the code (F8), it executes the line <BR>otherwise it doesn&#039;t. I&#039;ve use various types of recordsets without any success. I&#039;ve included the insert code and the connection code.<BR><BR>Thanks in advance.<BR><BR>********************************** **************<BR>Private Sub lstMgrProjects_DblClick(Cancel As Integer)<BR><BR>Dim rst As ADODB.Recordset<BR>Dim lngMgr As Long<BR>Dim strUser As String<BR>Dim intRegion As Integer<BR><BR><BR>Call dBConnect (see code below)<BR>Set rst = New ADODB.Recordset<BR>rst.Open "tblManagerTransfer", Conn, adOpenDynamic, adLockOptimistic, adCmdTableDirect<BR><BR>With rst<BR> .AddNew<BR> .Fields("MgrID") = Me![cboProposedMgr].Column(0)<BR> .Fields("ProjectID") = Me![lstMgrProjects].Column(0)<BR> .Update<BR> .Close<BR>End With<BR><BR>DoEvents<BR><BR>&#039;This is where I&#039;m pulling my hair out ... <BR>lstProposedMgr.Requery<BR><BR>Set rst = Nothing<BR>Set Conn = Nothing<BR><BR>End Sub<BR><BR>*************************************** **************************<BR>Public Sub dBConnect()<BR>Dim cmd As ADODB.Command<BR>Dim rst As ADODB.Recordset<BR>Set Conn = New ADODB.Connection<BR><BR>With Conn<BR> .Provider = "Microsoft.Jet.OLEDB.4.0"<BR> .ConnectionString = DLookup("[ConString]", "tblConnection")<BR> .Mode = adModeReadWrite<BR> .Open<BR>End With<BR><BR>End Sub

  2. #2
    Join Date
    Dec 1969

    Default I think Access distinguishes...

    ...between Requery and Refresh. I found that sometimes Requery doesn&#039;t work but Refresh does, or the other way round - or even sometimes both have to be run, Requery then Refresh.<BR><BR>Oliver.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts