I have a form on a laptop that opens a second form that imports Work Order data from the server based on what was selected in the first form. All works fine except when I place a condition (CheckLinks) in the routine to check if the laptop is connected to the network. The CheckLinks function is something I found on this forum.
The import works fine on the first click. However, if I try to import a second work order, it does not import. If I exit the app and reopen, then import second WO, it works fine - OR - if I comment out the CheckLinks all works fine unless the laptop is not connected to the network (it then bombs with an error). Is there some code I can place in front of the CheckLinks function the would act like I exited the program and reopened without having to actually do so? I tried Me.Recal, Me.Requery, Me.Refresh to no avail.
Here is my code:
Private Sub cmdImportSAN_Click()
Dim stLinkCriteria As String
If Not CheckLinks("tactNEW") Then
MsgBox "Network not available. Please verify connection.... ", vbOKOnly, "Link Not Active"
Else
DoCmd.OpenForm "frmImportWO", , , stLinkCriteria
Forms!frmImportWO!cmbWO_Import.RowSource = "SELECT DISTINCT [WO_ID] FROM [tactn] where [system] = 'SAN' order by [WO_ID] DESC"
End If
End Sub
Any suggestions would be greatly appreciated.
Thanks,
SKK
The import works fine on the first click. However, if I try to import a second work order, it does not import. If I exit the app and reopen, then import second WO, it works fine - OR - if I comment out the CheckLinks all works fine unless the laptop is not connected to the network (it then bombs with an error). Is there some code I can place in front of the CheckLinks function the would act like I exited the program and reopened without having to actually do so? I tried Me.Recal, Me.Requery, Me.Refresh to no avail.
Here is my code:
Private Sub cmdImportSAN_Click()
Dim stLinkCriteria As String
If Not CheckLinks("tactNEW") Then
MsgBox "Network not available. Please verify connection.... ", vbOKOnly, "Link Not Active"
Else
DoCmd.OpenForm "frmImportWO", , , stLinkCriteria
Forms!frmImportWO!cmbWO_Import.RowSource = "SELECT DISTINCT [WO_ID] FROM [tactn] where [system] = 'SAN' order by [WO_ID] DESC"
End If
End Sub
Any suggestions would be greatly appreciated.
Thanks,
SKK