Help with listbox refresh after table upload

tommy_mo

Registered User.
Local time
Today, 15:15
Joined
Oct 5, 2006
Messages
42
Hello-
I was wondering if anyone here could help me modify the following code. I would like to use several unbound listboxes in a form to display several queries based on one uploaded table. I can't seems to get the code right so that the listboxes refresh after the Hot Sync completes. I've tried to change the code in red to form.refresh or form.requery, but it doesn't seem to work. If I exit the form and open it again it will have the updates though. Also, if I perform a second sync operation it will update. (I'll admit that I know almost nothing about VB coding.) Can anyone give me some tips? I've posted this in the VBA forum too. Cheers. -Tom



Private Sub Form_Load()
Dim TableFileName

' Enable Satellite Forms control
SF.Enabled = True

Me.Listbox.Requery
UsrMsg = "Ready to HotSync."

' Set table name and check if it exists

TableFileName = DataPath & "Columbia_Answers.mdb"

On Error GoTo Err_FileError
GetAttr (TableFileName)


Exit_NoError:

' normal exit
Exit Sub

Err_FileError:

MsgBox ("Error: The database file '" & TableFileName & "' was not found. If you have" & _
" not generated the needed MDB files by " & _
"having not done a 'Save As' of your SFA file with App Designer please do so. If you installed " & _
"Satellite Forms " & _
"to a directory other than the default directory, you must change the initialization " & _
"of the variable 'TableFilename' in the Form_Load Sub to point to the correct location " & _
"of this file. " & _
"Then you should also delete the linked database tables and link it again from the " & _
"correct location.")

MsgBox Err.Description


End Sub



Private Sub SF_HotSyncStatus(ByVal StatusCode As Long, ByVal Param As Long)
'is proper creator ID?
If SF.CreatorString <> "SMSF" Then Exit Sub

Select Case StatusCode
'*** HotSyncStart
Case 1
Errors = 0
Call SF.GetTableFromPalmPilot(DataPath & "Columbia_Answers.mdb", "SMSF", "SDDI_PalmDB.dll", 0, 0, 0)
UsrMsg = "Uploading Data."
Beep
CmdCount = 1

'*** HotSyncCommandComplete
Case 3
CmdCount = CmdCount - 1
If (Param = 0) Then
Errors = Errors + 1
UsrMsg = Errors & " Error(s), Table= " & SF.CmdFilename
ElseIf (CmdCount <= 0) And (Errors = 0) Then
UsrMsg = "Data Uploaded."
Beep
End If

'*** HotSyncEnd
Case 2
' refresh form with new data
refresh

Case Else
MsgBox ("ERROR: Unexpected StatusCode value.")

End Select

End Sub
 

Users who are viewing this thread

Back
Top Bottom