A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

What is wrong with this



 
 
Thread Tools Display Modes
  #1  
Old February 19th, 2006, 02:36 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default What is wrong with this

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)

@@--Seems like the Number1 is not being fed the value here @@

If rstBALLS.EOF = True Then NO_More_Powerball_Nos

Debug.Print "We found Balls "
--
Charlie
  #2  
Old February 19th, 2006, 03:54 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default What is wrong with this

I quick glance shows an extra comma at the end of this line.
& " FROM [BALL COUNT]," _
I assume there is a bunch more code following what you presented to us.

You should also get in the habit of using
Dim dbsBALLS as DAO.Database
Dim rstBALLS As DAO.Recordset

Consider changing the name of Command3 to something that might make sense to
someone viewing your code window.

Why do you think "@@--Seems like the Number1 is not being fed the value here
@@"?

What is "NO_More_Powerball_Nos"?
--
Duane Hookom
MS Access MVP
--

"Charlie" wrote in message
...
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)

@@--Seems like the Number1 is not being fed the value here @@

If rstBALLS.EOF = True Then NO_More_Powerball_Nos

Debug.Print "We found Balls "
--
Charlie



  #3  
Old February 20th, 2006, 03:05 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default What is wrong with this

Here is all the code to date, the form is a simple toggle button to executer
the code and when I hit it I get and erro message:

runtime error 3061
too few parameters, expected 1.

And this line gets lit up in yellow....

Seems to me Number1 does not get transplted to the value its set to !!


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

---------------------------------------------------------------------------------
Option Compare Database
Option Explicit

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

Private Sub Start_Button_Click()


'On Error GoTo Err_Start_button_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 the records then, eq to the ball # , at this time add the
number if not founf

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

If rstBALLS.EOF = True Then NO_More_Powerball_Nos

Debug.Print "We found Balls "

Stop

End Sub

Public Sub NO_More_Powerball_Nos()
Debug.Print "No More Balls "
' Dim dbsBALLS As Database
'Dim rstBALLS As Recordset
'Set dbsBALLS = CurrentDb
' Set rstBALLS = dbsBALLS.OpenRecordset("select * " _
' & " FROM [BALL COUNT] ")
rstBALLS.AddNew
rstBALLS![ball number] = Number1
rstBALLS![number count] = rstBALLS![number count] + 1
rstBALLS.Update
rstBALLS.Close

Stop



Exit_Start_button_Click:
Exit Sub

Err_Start_button_Click:
MsgBox Err.Description
Resume Exit_Start_button_Click


do_1:

' This part we have not worked on as we cant get by the Start_button stuff

With rstBALLS

.Edit
' Add one to count
rstBALLS![number count] = rstBALLS![number count] + 1
.Update
.Close
End With
End Sub

------------------------------------------------------------------------------
--
Charlie


"Duane Hookom" wrote:

I quick glance shows an extra comma at the end of this line.
& " FROM [BALL COUNT]," _
I assume there is a bunch more code following what you presented to us.

You should also get in the habit of using
Dim dbsBALLS as DAO.Database
Dim rstBALLS As DAO.Recordset

Consider changing the name of Command3 to something that might make sense to
someone viewing your code window.

Why do you think "@@--Seems like the Number1 is not being fed the value here
@@"?

What is "NO_More_Powerball_Nos"?
--
Duane Hookom
MS Access MVP
--

"Charlie" wrote in message
...
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)

@@--Seems like the Number1 is not being fed the value here @@

If rstBALLS.EOF = True Then NO_More_Powerball_Nos

Debug.Print "We found Balls "
--
Charlie




  #4  
Old February 20th, 2006, 03:17 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default What is wrong with this

On Sun, 19 Feb 2006 19:05:27 -0800, "Charlie"
wrote:

Here is all the code to date, the form is a simple toggle button to executer
the code and when I hit it I get and erro message:

runtime error 3061
too few parameters, expected 1.

And this line gets lit up in yellow....

Seems to me Number1 does not get transplted to the value its set to !!


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


That's because you're sending the query the *NAME* of the variable
rather than the *VALUE* of that variable.

Try

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


John W. Vinson[MVP]

  #5  
Old February 21st, 2006, 01:19 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default What is wrong with this

Hi,

Thanks for the help, with your input and my persistance, I amanged to
get to and end. with this program. I'm not sure more my analogy of poert
balll numbers will work but its code now.





--
Charlie


"John Vinson" wrote:

On Sun, 19 Feb 2006 19:05:27 -0800, "Charlie"
wrote:

Here is all the code to date, the form is a simple toggle button to executer
the code and when I hit it I get and erro message:

runtime error 3061
too few parameters, expected 1.

And this line gets lit up in yellow....

Seems to me Number1 does not get transplted to the value its set to !!


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


That's because you're sending the query the *NAME* of the variable
rather than the *VALUE* of that variable.

Try

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


John W. Vinson[MVP]


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Meeting request on wrong day Joeri Bruneel Calendar 3 October 18th, 2005 06:46 PM
Wrong timestamp on incoming and outgoing messages Patrick General Discussion 1 August 30th, 2005 10:10 PM
wrong emails in OE MR Outlook Express 2 May 17th, 2005 04:56 PM
Distribution list addresses are wrong. How to send e-mail regardle Laurie P General Discussion 2 March 7th, 2005 09:51 AM
Outlook 2003 replies via WRONG account, uses Default instead geek4eye Installation & Setup 0 January 10th, 2005 04:13 PM


All times are GMT +1. The time now is 11:29 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.