type Mismatch Error....

L

Lee Taylor-Vaughan

Hello group,

I have tried to get the following code to work, but i keep getting the
follwing error - upon the form opening it get "error number 13 : type
mismatch"
also my CountRecords Private Sub does not work, and neither does the
SearchNow private module... what i am doing wrong?

I think it is related to the sql code.. please explain.. Thanks in advance
(code below)

CODE>>>

Option Compare Database
Option Explicit
'sql statements used to polpulate lstbox (initial sql w/out order by &
where)
Const cstrOldSQL1 = "SELECT tblActivity.ControlNumberID AS CNumber, "
Const cstrOldSQL2 = "tblActivity.DateDispatch AS [Disp Date], "
Const cstrOldSQL3 = "tblActivity.DispatchType AS Type,
tblActivity.TimeDispatch AS [Disp Time], "
Const cstrOldSQL4 = "tblActivity.IncidentLocationCity AS Location, "
Const cstrOldSQL5 = "[PatientLastName] & '" & ", ' & [patientfirstname] AS
[Pt Name] "
Const cstrOldSQL6 = "FROM tblActivity INNER JOIN tblPatients "
Const cstrOldSQL7 = "ON
tblActivity.ControlNumberID=tblPatients.ControlNumberID"
'concatenates above constants for form one...
Const cstrOldSQLa = cstrOldSQL1 & cstrOldSQL2 & cstrOldSQL3 & cstrOldSQL4 &
cstrOldSQL5 & cstrOldSQL6
Const cstrOldSQL = cstrOldSQLa & cstrOldSQL7
'default sql construct
Const cstrDefaultOrder = " ORDER BY tblActivity.datedispatch DESC ,
tblActivity.TimeDispatch;"
Const cstrDefaultSQL = cstrOldSQL & cstrDefaultOrder

Private Sub Command274_Click()
CountRecords
End Sub


Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open

cmdReset_Click
DoCmd.Restore

Exit_Form_Open:
Exit Sub

Err_Form_Open:
MsgBox Err.Number & Err.Description
Resume Exit_Form_Open
End Sub

Private Sub cmdReset_Click()

' Assign put the new SQL value into the recordsource
Me.lstDispMain.RowSource = cstrDefaultSQL
Me.lstDispMain.Requery
Me.Refresh
Me.Repaint

CountRecords

End Sub

Private Sub CountRecords()
On Error GoTo Err_Clear_Click
Dim lngCount As Integer
Dim dbCurrent As Database
Dim rsData As Recordset
Set dbCurrent = CurrentDb
Set rsData = CurrentDb.OpenRecordset(Me.lstDispMain.RowSource)
lngCount = 0
With rsData
.MoveLast
.MoveFirst

Do While rsData.EOF = False
.MoveNext
lngCount = lngCount + 1
Debug.Print lngCount
Loop

End With

Forms!frmDispatchMain.txtTotal = lngCount

Exit_Clear_Click:
Exit Sub

Err_Clear_Click:
Select Case Err.Number
Case Is = 3021 'no records in set
MsgBox "There are no Dispatches for your selection"
Me.lstDispMain.RowSource = cstrDefaultSQL
Exit Sub
Case Else
MsgBox Err.Number & ": " & Err.Description, vbCritical, "Error
Message, gulp...!"
Exit Sub
End Select

Set dbCurrent = Nothing
Set rsData = Nothing

End Sub

Private Sub cmdSQL_Click()

MsgBox Me.lstDispMain.RowSource, vbInformation + vbOKOnly, "SQL Statement
used for: " & Me.Name

End Sub


Public Sub cmdSearchNow_Click()
On Error GoTo Err_cmdSearch_Click

Dim strNewSQL As String ' variable to hold the new SQL string for the
RecordSource
Dim dbCurrent As Database
Dim rsData As Recordset
Dim lngCount As Integer

Select Case optSearch
Case 1
If IsNull(Forms!frmDispatchMain!txtFind) Then ' Search by Patient Last
Name
MsgBox "Please enter a name.", , "Data Required"
Exit Sub
ElseIf Not IsNull(Me.txtFind) Then
strNewSQL = cstrOldSQL & " Where [Pt Name] Like '" &
Forms!frmDispatchMain![txtFind].Value & "*' Order by [Pt Name];"
End If

Case 2
If IsNull(txtFind) Then ' Search by control number
MsgBox "Please enter a Control Number (Last 6).", , "Data Required"
Exit Sub
ElseIf Not IsNull(txtFind) Then
strNewSQL = cstrOldSQL & " Where tblActivity.ControlNumberID Like '" &
Forms!frmDispatchMain![txtFind].Value & "*' Order by
tblActivity.ControlNumberID;"
End If

Case 3

If IsNull(txtFind) Then ' Search by Date
MsgBox "Please enter a Date in mm/dd/yy format", , "Data Required"
Exit Sub
ElseIf Not IsNull(txtFind) Then
strNewSQL = cstrOldSQL & " Where tblActivity.datedispatch = #" &
Forms!frmDispatchMain![txtFind].Value & "# Order by
tblActivity.datedispatch,tblActivity.TimeDIspatch;"
End If

End Select
Forms!frmDispatchMain.lstDispMain = strNewSQL
Forms!frmDispatchMain.lstDispMain.Requery
Forms!frmDispatchMain.Refresh
Forms!frmDispatchMain.Repaint


CountRecords

' Assign put the new SQL value into the recordsource


Exit_cmdSearch_Click:
Exit Sub

Err_cmdSearch_Click:
If Err.Number = 3021 Then
MsgBox "There are no Missions for your selection; please retry your
search...", , "Search"
strNewSQL = cstrDefaultSQL
Forms!frmDispatchMain.lstDispMain.RowSource = strNewSQL
Forms!frmDispatchMain.Requery
Else
MsgBox Err.Number & Err.Description
Resume Exit_cmdSearch_Click
End If
Resume Exit_cmdSearch_Click

End Sub
 
K

Ken Snell

Let's start with the mismatch error. Are you using ACCESS 2000 or 2002? If
yes, likely you haven't set a reference to the DAO library in the Visual
Basic Editor references. Do that and then preface with "DAO." (without the
"s) the Recordset in the Dim statement in CountRecords sub.

--
Ken Snell
<MS ACCESS MVP>

Lee Taylor-Vaughan said:
Hello group,

I have tried to get the following code to work, but i keep getting the
follwing error - upon the form opening it get "error number 13 : type
mismatch"
also my CountRecords Private Sub does not work, and neither does the
SearchNow private module... what i am doing wrong?

I think it is related to the sql code.. please explain.. Thanks in advance
(code below)

CODE>>>

Option Compare Database
Option Explicit
'sql statements used to polpulate lstbox (initial sql w/out order by &
where)
Const cstrOldSQL1 = "SELECT tblActivity.ControlNumberID AS CNumber, "
Const cstrOldSQL2 = "tblActivity.DateDispatch AS [Disp Date], "
Const cstrOldSQL3 = "tblActivity.DispatchType AS Type,
tblActivity.TimeDispatch AS [Disp Time], "
Const cstrOldSQL4 = "tblActivity.IncidentLocationCity AS Location, "
Const cstrOldSQL5 = "[PatientLastName] & '" & ", ' & [patientfirstname] AS
[Pt Name] "
Const cstrOldSQL6 = "FROM tblActivity INNER JOIN tblPatients "
Const cstrOldSQL7 = "ON
tblActivity.ControlNumberID=tblPatients.ControlNumberID"
'concatenates above constants for form one...
Const cstrOldSQLa = cstrOldSQL1 & cstrOldSQL2 & cstrOldSQL3 & cstrOldSQL4 &
cstrOldSQL5 & cstrOldSQL6
Const cstrOldSQL = cstrOldSQLa & cstrOldSQL7
'default sql construct
Const cstrDefaultOrder = " ORDER BY tblActivity.datedispatch DESC ,
tblActivity.TimeDispatch;"
Const cstrDefaultSQL = cstrOldSQL & cstrDefaultOrder

Private Sub Command274_Click()
CountRecords
End Sub


Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open

cmdReset_Click
DoCmd.Restore

Exit_Form_Open:
Exit Sub

Err_Form_Open:
MsgBox Err.Number & Err.Description
Resume Exit_Form_Open
End Sub

Private Sub cmdReset_Click()

' Assign put the new SQL value into the recordsource
Me.lstDispMain.RowSource = cstrDefaultSQL
Me.lstDispMain.Requery
Me.Refresh
Me.Repaint

CountRecords

End Sub

Private Sub CountRecords()
On Error GoTo Err_Clear_Click
Dim lngCount As Integer
Dim dbCurrent As Database
Dim rsData As Recordset
Set dbCurrent = CurrentDb
Set rsData = CurrentDb.OpenRecordset(Me.lstDispMain.RowSource)
lngCount = 0
With rsData
.MoveLast
.MoveFirst

Do While rsData.EOF = False
.MoveNext
lngCount = lngCount + 1
Debug.Print lngCount
Loop

End With

Forms!frmDispatchMain.txtTotal = lngCount

Exit_Clear_Click:
Exit Sub

Err_Clear_Click:
Select Case Err.Number
Case Is = 3021 'no records in set
MsgBox "There are no Dispatches for your selection"
Me.lstDispMain.RowSource = cstrDefaultSQL
Exit Sub
Case Else
MsgBox Err.Number & ": " & Err.Description, vbCritical, "Error
Message, gulp...!"
Exit Sub
End Select

Set dbCurrent = Nothing
Set rsData = Nothing

End Sub

Private Sub cmdSQL_Click()

MsgBox Me.lstDispMain.RowSource, vbInformation + vbOKOnly, "SQL Statement
used for: " & Me.Name

End Sub


Public Sub cmdSearchNow_Click()
On Error GoTo Err_cmdSearch_Click

Dim strNewSQL As String ' variable to hold the new SQL string for the
RecordSource
Dim dbCurrent As Database
Dim rsData As Recordset
Dim lngCount As Integer

Select Case optSearch
Case 1
If IsNull(Forms!frmDispatchMain!txtFind) Then ' Search by Patient Last
Name
MsgBox "Please enter a name.", , "Data Required"
Exit Sub
ElseIf Not IsNull(Me.txtFind) Then
strNewSQL = cstrOldSQL & " Where [Pt Name] Like '" &
Forms!frmDispatchMain![txtFind].Value & "*' Order by [Pt Name];"
End If

Case 2
If IsNull(txtFind) Then ' Search by control number
MsgBox "Please enter a Control Number (Last 6).", , "Data Required"
Exit Sub
ElseIf Not IsNull(txtFind) Then
strNewSQL = cstrOldSQL & " Where tblActivity.ControlNumberID Like '" &
Forms!frmDispatchMain![txtFind].Value & "*' Order by
tblActivity.ControlNumberID;"
End If

Case 3

If IsNull(txtFind) Then ' Search by Date
MsgBox "Please enter a Date in mm/dd/yy format", , "Data Required"
Exit Sub
ElseIf Not IsNull(txtFind) Then
strNewSQL = cstrOldSQL & " Where tblActivity.datedispatch = #" &
Forms!frmDispatchMain![txtFind].Value & "# Order by
tblActivity.datedispatch,tblActivity.TimeDIspatch;"
End If

End Select
Forms!frmDispatchMain.lstDispMain = strNewSQL
Forms!frmDispatchMain.lstDispMain.Requery
Forms!frmDispatchMain.Refresh
Forms!frmDispatchMain.Repaint


CountRecords

' Assign put the new SQL value into the recordsource


Exit_cmdSearch_Click:
Exit Sub

Err_cmdSearch_Click:
If Err.Number = 3021 Then
MsgBox "There are no Missions for your selection; please retry your
search...", , "Search"
strNewSQL = cstrDefaultSQL
Forms!frmDispatchMain.lstDispMain.RowSource = strNewSQL
Forms!frmDispatchMain.Requery
Else
MsgBox Err.Number & Err.Description
Resume Exit_cmdSearch_Click
End If
Resume Exit_cmdSearch_Click

End Sub
 
L

Lee Taylor-Vaughan

using access 2000. I entered the DAO and it works fine.

is DAO better than ADO? what should i use if i am going to give a copy of my
database to an access novice. (i.e. so they dont have to add the reference
themselves).

thanks

Lee

Ken Snell said:
Let's start with the mismatch error. Are you using ACCESS 2000 or 2002? If
yes, likely you haven't set a reference to the DAO library in the Visual
Basic Editor references. Do that and then preface with "DAO." (without the
"s) the Recordset in the Dim statement in CountRecords sub.

--
Ken Snell
<MS ACCESS MVP>

Lee Taylor-Vaughan said:
Hello group,

I have tried to get the following code to work, but i keep getting the
follwing error - upon the form opening it get "error number 13 : type
mismatch"
also my CountRecords Private Sub does not work, and neither does the
SearchNow private module... what i am doing wrong?

I think it is related to the sql code.. please explain.. Thanks in advance
(code below)

CODE>>>

Option Compare Database
Option Explicit
'sql statements used to polpulate lstbox (initial sql w/out order by &
where)
Const cstrOldSQL1 = "SELECT tblActivity.ControlNumberID AS CNumber, "
Const cstrOldSQL2 = "tblActivity.DateDispatch AS [Disp Date], "
Const cstrOldSQL3 = "tblActivity.DispatchType AS Type,
tblActivity.TimeDispatch AS [Disp Time], "
Const cstrOldSQL4 = "tblActivity.IncidentLocationCity AS Location, "
Const cstrOldSQL5 = "[PatientLastName] & '" & ", ' & [patientfirstname] AS
[Pt Name] "
Const cstrOldSQL6 = "FROM tblActivity INNER JOIN tblPatients "
Const cstrOldSQL7 = "ON
tblActivity.ControlNumberID=tblPatients.ControlNumberID"
'concatenates above constants for form one...
Const cstrOldSQLa = cstrOldSQL1 & cstrOldSQL2 & cstrOldSQL3 &
cstrOldSQL4
&
cstrOldSQL5 & cstrOldSQL6
Const cstrOldSQL = cstrOldSQLa & cstrOldSQL7
'default sql construct
Const cstrDefaultOrder = " ORDER BY tblActivity.datedispatch DESC ,
tblActivity.TimeDispatch;"
Const cstrDefaultSQL = cstrOldSQL & cstrDefaultOrder

Private Sub Command274_Click()
CountRecords
End Sub


Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open

cmdReset_Click
DoCmd.Restore

Exit_Form_Open:
Exit Sub

Err_Form_Open:
MsgBox Err.Number & Err.Description
Resume Exit_Form_Open
End Sub

Private Sub cmdReset_Click()

' Assign put the new SQL value into the recordsource
Me.lstDispMain.RowSource = cstrDefaultSQL
Me.lstDispMain.Requery
Me.Refresh
Me.Repaint

CountRecords

End Sub

Private Sub CountRecords()
On Error GoTo Err_Clear_Click
Dim lngCount As Integer
Dim dbCurrent As Database
Dim rsData As Recordset
Set dbCurrent = CurrentDb
Set rsData = CurrentDb.OpenRecordset(Me.lstDispMain.RowSource)
lngCount = 0
With rsData
.MoveLast
.MoveFirst

Do While rsData.EOF = False
.MoveNext
lngCount = lngCount + 1
Debug.Print lngCount
Loop

End With

Forms!frmDispatchMain.txtTotal = lngCount

Exit_Clear_Click:
Exit Sub

Err_Clear_Click:
Select Case Err.Number
Case Is = 3021 'no records in set
MsgBox "There are no Dispatches for your selection"
Me.lstDispMain.RowSource = cstrDefaultSQL
Exit Sub
Case Else
MsgBox Err.Number & ": " & Err.Description, vbCritical, "Error
Message, gulp...!"
Exit Sub
End Select

Set dbCurrent = Nothing
Set rsData = Nothing

End Sub

Private Sub cmdSQL_Click()

MsgBox Me.lstDispMain.RowSource, vbInformation + vbOKOnly, "SQL Statement
used for: " & Me.Name

End Sub


Public Sub cmdSearchNow_Click()
On Error GoTo Err_cmdSearch_Click

Dim strNewSQL As String ' variable to hold the new SQL string for the
RecordSource
Dim dbCurrent As Database
Dim rsData As Recordset
Dim lngCount As Integer

Select Case optSearch
Case 1
If IsNull(Forms!frmDispatchMain!txtFind) Then ' Search by Patient Last
Name
MsgBox "Please enter a name.", , "Data Required"
Exit Sub
ElseIf Not IsNull(Me.txtFind) Then
strNewSQL = cstrOldSQL & " Where [Pt Name] Like '" &
Forms!frmDispatchMain![txtFind].Value & "*' Order by [Pt Name];"
End If

Case 2
If IsNull(txtFind) Then ' Search by control number
MsgBox "Please enter a Control Number (Last 6).", , "Data Required"
Exit Sub
ElseIf Not IsNull(txtFind) Then
strNewSQL = cstrOldSQL & " Where tblActivity.ControlNumberID Like
'"
&
Forms!frmDispatchMain![txtFind].Value & "*' Order by
tblActivity.ControlNumberID;"
End If

Case 3

If IsNull(txtFind) Then ' Search by Date
MsgBox "Please enter a Date in mm/dd/yy format", , "Data Required"
Exit Sub
ElseIf Not IsNull(txtFind) Then
strNewSQL = cstrOldSQL & " Where tblActivity.datedispatch = #" &
Forms!frmDispatchMain![txtFind].Value & "# Order by
tblActivity.datedispatch,tblActivity.TimeDIspatch;"
End If

End Select
Forms!frmDispatchMain.lstDispMain = strNewSQL
Forms!frmDispatchMain.lstDispMain.Requery
Forms!frmDispatchMain.Refresh
Forms!frmDispatchMain.Repaint


CountRecords

' Assign put the new SQL value into the recordsource


Exit_cmdSearch_Click:
Exit Sub

Err_cmdSearch_Click:
If Err.Number = 3021 Then
MsgBox "There are no Missions for your selection; please retry your
search...", , "Search"
strNewSQL = cstrDefaultSQL
Forms!frmDispatchMain.lstDispMain.RowSource = strNewSQL
Forms!frmDispatchMain.Requery
Else
MsgBox Err.Number & Err.Description
Resume Exit_cmdSearch_Click
End If
Resume Exit_cmdSearch_Click

End Sub
 
K

Ken Snell

Once you set the reference in a database, it stays in that database. So no
problem if you give a copy to someone else.

Choosing between DAO and ADODB (ADO) is a matter of what you're wanting to
do in the code. DAO is designed to work well with Jet engine in ACCESS; ADO
is designed to interact with various types of databases. DAO has more
flexibility to interact with, read, manipulate, and modify tables and
queries in ACCESS.

The reason I suggested the DAO addition is because the code you're trying to
run is using DAO-specific methods (ones not used in ADO).
--
Ken Snell
<MS ACCESS MVP>



Lee Taylor-Vaughan said:
using access 2000. I entered the DAO and it works fine.

is DAO better than ADO? what should i use if i am going to give a copy of my
database to an access novice. (i.e. so they dont have to add the reference
themselves).

thanks

Lee

Ken Snell said:
Let's start with the mismatch error. Are you using ACCESS 2000 or 2002? If
yes, likely you haven't set a reference to the DAO library in the Visual
Basic Editor references. Do that and then preface with "DAO." (without the
"s) the Recordset in the Dim statement in CountRecords sub.

--
Ken Snell
<MS ACCESS MVP>

Lee Taylor-Vaughan said:
Hello group,

I have tried to get the following code to work, but i keep getting the
follwing error - upon the form opening it get "error number 13 : type
mismatch"
also my CountRecords Private Sub does not work, and neither does the
SearchNow private module... what i am doing wrong?

I think it is related to the sql code.. please explain.. Thanks in advance
(code below)

CODE>>>

Option Compare Database
Option Explicit
'sql statements used to polpulate lstbox (initial sql w/out order by &
where)
Const cstrOldSQL1 = "SELECT tblActivity.ControlNumberID AS CNumber, "
Const cstrOldSQL2 = "tblActivity.DateDispatch AS [Disp Date], "
Const cstrOldSQL3 = "tblActivity.DispatchType AS Type,
tblActivity.TimeDispatch AS [Disp Time], "
Const cstrOldSQL4 = "tblActivity.IncidentLocationCity AS Location, "
Const cstrOldSQL5 = "[PatientLastName] & '" & ", ' &
[patientfirstname]
AS
[Pt Name] "
Const cstrOldSQL6 = "FROM tblActivity INNER JOIN tblPatients "
Const cstrOldSQL7 = "ON
tblActivity.ControlNumberID=tblPatients.ControlNumberID"
'concatenates above constants for form one...
Const cstrOldSQLa = cstrOldSQL1 & cstrOldSQL2 & cstrOldSQL3 &
cstrOldSQL4
&
cstrOldSQL5 & cstrOldSQL6
Const cstrOldSQL = cstrOldSQLa & cstrOldSQL7
'default sql construct
Const cstrDefaultOrder = " ORDER BY tblActivity.datedispatch DESC ,
tblActivity.TimeDispatch;"
Const cstrDefaultSQL = cstrOldSQL & cstrDefaultOrder

Private Sub Command274_Click()
CountRecords
End Sub


Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open

cmdReset_Click
DoCmd.Restore

Exit_Form_Open:
Exit Sub

Err_Form_Open:
MsgBox Err.Number & Err.Description
Resume Exit_Form_Open
End Sub

Private Sub cmdReset_Click()

' Assign put the new SQL value into the recordsource
Me.lstDispMain.RowSource = cstrDefaultSQL
Me.lstDispMain.Requery
Me.Refresh
Me.Repaint

CountRecords

End Sub

Private Sub CountRecords()
On Error GoTo Err_Clear_Click
Dim lngCount As Integer
Dim dbCurrent As Database
Dim rsData As Recordset
Set dbCurrent = CurrentDb
Set rsData = CurrentDb.OpenRecordset(Me.lstDispMain.RowSource)
lngCount = 0
With rsData
.MoveLast
.MoveFirst

Do While rsData.EOF = False
.MoveNext
lngCount = lngCount + 1
Debug.Print lngCount
Loop

End With

Forms!frmDispatchMain.txtTotal = lngCount

Exit_Clear_Click:
Exit Sub

Err_Clear_Click:
Select Case Err.Number
Case Is = 3021 'no records in set
MsgBox "There are no Dispatches for your selection"
Me.lstDispMain.RowSource = cstrDefaultSQL
Exit Sub
Case Else
MsgBox Err.Number & ": " & Err.Description, vbCritical, "Error
Message, gulp...!"
Exit Sub
End Select

Set dbCurrent = Nothing
Set rsData = Nothing

End Sub

Private Sub cmdSQL_Click()

MsgBox Me.lstDispMain.RowSource, vbInformation + vbOKOnly, "SQL Statement
used for: " & Me.Name

End Sub


Public Sub cmdSearchNow_Click()
On Error GoTo Err_cmdSearch_Click

Dim strNewSQL As String ' variable to hold the new SQL string for the
RecordSource
Dim dbCurrent As Database
Dim rsData As Recordset
Dim lngCount As Integer

Select Case optSearch
Case 1
If IsNull(Forms!frmDispatchMain!txtFind) Then ' Search by Patient Last
Name
MsgBox "Please enter a name.", , "Data Required"
Exit Sub
ElseIf Not IsNull(Me.txtFind) Then
strNewSQL = cstrOldSQL & " Where [Pt Name] Like '" &
Forms!frmDispatchMain![txtFind].Value & "*' Order by [Pt Name];"
End If

Case 2
If IsNull(txtFind) Then ' Search by control number
MsgBox "Please enter a Control Number (Last 6).", , "Data Required"
Exit Sub
ElseIf Not IsNull(txtFind) Then
strNewSQL = cstrOldSQL & " Where tblActivity.ControlNumberID Like
'"
&
Forms!frmDispatchMain![txtFind].Value & "*' Order by
tblActivity.ControlNumberID;"
End If

Case 3

If IsNull(txtFind) Then ' Search by Date
MsgBox "Please enter a Date in mm/dd/yy format", , "Data Required"
Exit Sub
ElseIf Not IsNull(txtFind) Then
strNewSQL = cstrOldSQL & " Where tblActivity.datedispatch = #" &
Forms!frmDispatchMain![txtFind].Value & "# Order by
tblActivity.datedispatch,tblActivity.TimeDIspatch;"
End If

End Select
Forms!frmDispatchMain.lstDispMain = strNewSQL
Forms!frmDispatchMain.lstDispMain.Requery
Forms!frmDispatchMain.Refresh
Forms!frmDispatchMain.Repaint


CountRecords

' Assign put the new SQL value into the recordsource


Exit_cmdSearch_Click:
Exit Sub

Err_cmdSearch_Click:
If Err.Number = 3021 Then
MsgBox "There are no Missions for your selection; please retry your
search...", , "Search"
strNewSQL = cstrDefaultSQL
Forms!frmDispatchMain.lstDispMain.RowSource = strNewSQL
Forms!frmDispatchMain.Requery
Else
MsgBox Err.Number & Err.Description
Resume Exit_cmdSearch_Click
End If
Resume Exit_cmdSearch_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top