Whats my errpr here

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Option Compare Database
Option Explicit

Dim dbsBALLS As Database
Dim rstBALLS As Recordset
Dim intBALLS As Integer

Public Sub Command3_Click()
'On Error GoTo Err_Command3_Click

Dim stDocName As String
Dim stLinkCriteria As String
Dim Number1 As Integer
Dim Number2 As Integer
Dim Number3 As Integer
Dim Number4 As Integer
Dim Number5 As Integer

Number1 = 16
Number2 = 26
Number3 = 36
Number4 = 46
Number5 = 6
Debug.Print "No 1", Number1
Debug.Print "No 2", Number2
Debug.Print "No 3", Number3
Debug.Print "No 4", Number4
Debug.Print "No 5", Number5

Rem This code gets all power ball numbers FROM THE FILE
Set dbsBALLS = CurrentDb

'Here we get all the records then, cycle thru them to find the right bus

Set rstBALLS = dbsBALLS.OpenRecordset("select * " _
& " FROM [BALL COUNT]," _
& "WHERE [ball number] =" & Number1)
^

l

---This is not defined
If rstBALLS.EOF = True Then NO_More_Powerball_Nos

Debug.Print "We found Balls "
 
It would help if you said what error message you're receiving...

I'm going to guess, and say that it's a type mismatch error, in which case
change

Dim rstBALLS As Recordset

to

Dim rstBALLS As DAO.Recordset

Whe you have references to both the ADO and DAO models, you'll find that
you'll need to "disambiguate" certain declarations, because objects with the
same names exist in the 2 models. For example, to ensure that you get a DAO
recordset, you'll need to use Dim rsCurr as DAO.Recordset (to guarantee an
ADO recordset, you'd use Dim rsCurr As ADODB.Recordset)

The list of objects with the same names in the 2 models is Connection,
Error, Errors, Field, Fields, Parameter, Parameters, Property, Properties
and Recordset
 
Back
Top