473,387 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

too few perameters expected 1

Hi folks!
I have pasted some code from anothere Db that works. the only thing
thats changed is the field names and the query. I then get the above??
I am completely stumped the references are the same and one works on
the same computer and the other doesn't. the following is the code
that does'nt.
Tia
Phil

Private Sub Postcode_AfterUpdate()
On Error GoTo Postcode_AfterUpdate_Err
Dim db As Database, rstAddress As Recordset

Set db = CurrentDb()
Set rstAddress = db.OpenRecordset("Select * From qryaddresses
Where [post Code] = " & " '" & Me![Postcode] & "'", dbOpenDynaset)
Street = rstAddress![Street]
PAO = rstAddress![PAO]
SAO = rstAddress![SAO]
Town = rstAddress![Town]
Me![PAO].SetFocus
rstAddress.Close
Set db = Nothing
Postcode_AfterUpdate_Exit:
Exit Sub

Postcode_AfterUpdate_Err:
Select Case Err.Number
Case Else
MsgBox Err.Description
Resume Postcode_AfterUpdate_Exit
Resume
End Select

End Sub

Aug 14 '07 #1
8 1309
What happens if the post code is blank?
<Ph************@lineone.netwrote in message
news:11*********************@w3g2000hsg.googlegrou ps.com...
Hi folks!
I have pasted some code from anothere Db that works. the only thing
thats changed is the field names and the query. I then get the above??
I am completely stumped the references are the same and one works on
the same computer and the other doesn't. the following is the code
that does'nt.
Tia
Phil

Private Sub Postcode_AfterUpdate()
On Error GoTo Postcode_AfterUpdate_Err
Dim db As Database, rstAddress As Recordset

Set db = CurrentDb()
Set rstAddress = db.OpenRecordset("Select * From qryaddresses
Where [post Code] = " & " '" & Me![Postcode] & "'", dbOpenDynaset)
Street = rstAddress![Street]
PAO = rstAddress![PAO]
SAO = rstAddress![SAO]
Town = rstAddress![Town]
Me![PAO].SetFocus
rstAddress.Close
Set db = Nothing
Postcode_AfterUpdate_Exit:
Exit Sub

Postcode_AfterUpdate_Err:
Select Case Err.Number
Case Else
MsgBox Err.Description
Resume Postcode_AfterUpdate_Exit
Resume
End Select

End Sub

Aug 14 '07 #2
Try this. Your Where statement quotes were incorrect. I moved them outside
of the Open command for readability.

Private Sub Postcode_AfterUpdate()
On Error GoTo Postcode_AfterUpdate_Err
Dim db As Database, rstAddress As Recordset
Dim strSQL as String

strSQL = "Select * From qryaddresses " _
&"Where [Post Code] = '" & Me!PostCode & "'"

Set db = CurrentDb()
Set rstAddress = db.OpenRecordset strSQL, dbOpenDynaset
Street = rstAddress![Street]
PAO = rstAddress![PAO]
SAO = rstAddress![SAO]
Town = rstAddress![Town]
Me![PAO].SetFocus
rstAddress.Close
Set db = Nothing
Postcode_AfterUpdate_Exit:
Exit Sub

Postcode_AfterUpdate_Err:
Select Case Err.Number
Case Else
MsgBox Err.Description
Resume Postcode_AfterUpdate_Exit
Resume
End Select

End Sub

Len Robichaud
Aug 14 '07 #3
Ph************@lineone.net wrote in
news:11*********************@w3g2000hsg.googlegrou ps.com:
Hi folks!
I have pasted some code from anothere Db that works. the only
thing thats changed is the field names and the query. I then
get the above?? I am completely stumped the references are the
same and one works on the same computer and the other doesn't.
the following is the code that does'nt.
Tia
Phil
That error often indicates that Jet has failed to digest the
SQL. Check for typos in field names, missing spaces, etc.

A handy way to debug is to first build the SQL into a variable,
so you can debug.print it.

Dim stSQL as string
stSQL = "SELECT * FROM qryAddresses WHERE "
stSQL = stSQL & Where [post Code] = " & " '"
stSQL = stSQL & Me!Postcode & "'"
debug.print stSQL
Set rstAddress = db.OpenRecordset(stSQL,dbOpenDynaset)

HTH,
Q
Private Sub Postcode_AfterUpdate()
On Error GoTo Postcode_AfterUpdate_Err
Dim db As Database, rstAddress As Recordset

Set db = CurrentDb()
Set rstAddress = db.OpenRecordset("Select * From
qryaddresses
Where [post Code] = " & " '" & Me![Postcode] & "'",
dbOpenDynaset)
Street = rstAddress![Street]
PAO = rstAddress![PAO]
SAO = rstAddress![SAO]
Town = rstAddress![Town]
Me![PAO].SetFocus
rstAddress.Close
Set db = Nothing
Postcode_AfterUpdate_Exit:
Exit Sub

Postcode_AfterUpdate_Err:
Select Case Err.Number
Case Else
MsgBox Err.Description
Resume Postcode_AfterUpdate_Exit
Resume
End Select

End Sub



--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Aug 15 '07 #4
On 14 Aug, 23:16, "Phil Stanton" <p...@stantonfamily.co.ukwrote:
What happens if the post code is blank?<Philip_coll...@lineone.netwrote in message

news:11*********************@w3g2000hsg.googlegrou ps.com...
Hi folks!
I have pasted some code from anothere Db that works. the only thing
thats changed is the field names and the query. I then get the above??
I am completely stumped the references are the same and one works on
the same computer and the other doesn't. the following is the code
that does'nt.
Tia
Phil
Private Sub Postcode_AfterUpdate()
On Error GoTo Postcode_AfterUpdate_Err
Dim db As Database, rstAddress As Recordset
Set db = CurrentDb()
Set rstAddress = db.OpenRecordset("Select * From qryaddresses
Where [post Code] = " & " '" & Me![Postcode] & "'", dbOpenDynaset)
Street = rstAddress![Street]
PAO = rstAddress![PAO]
SAO = rstAddress![SAO]
Town = rstAddress![Town]
Me![PAO].SetFocus
rstAddress.Close
Set db = Nothing
Postcode_AfterUpdate_Exit:
Exit Sub
Postcode_AfterUpdate_Err:
Select Case Err.Number
Case Else
MsgBox Err.Description
Resume Postcode_AfterUpdate_Exit
Resume
End Select
End Sub- Hide quoted text -

- Show quoted text -
Hi Thank you for responding

Private Sub Postcode_LostFocus()
If IsNull(Me.Postcode) Then
Me.PAO.SetFocus
End If
End Sub
Thanks again Phil

Aug 15 '07 #5
On 14 Aug, 22:31, Bob Quintal <rquin...@sPAmpatico.cawrote:
Philip_coll...@lineone.net wrote innews:11*********************@w3g2000hsg.googlegr oups.com:
Hi folks!
I have pasted some code from anothere Db that works. the only
thing thats changed is the field names and the query. I then
get the above?? I am completely stumped the references are the
same and one works on the same computer and the other doesn't.
the following is the code that does'nt.
Tia
Phil

That error often indicates that Jet has failed to digest the
SQL. Check for typos in field names, missing spaces, etc.

A handy way to debug is to first build the SQL into a variable,
so you can debug.print it.

Dim stSQL as string
stSQL = "SELECT * FROM qryAddresses WHERE "
stSQL = stSQL & Where [post Code] = " & " '"
stSQL = stSQL & Me!Postcode & "'"
debug.print stSQL
Set rstAddress = db.OpenRecordset(stSQL,dbOpenDynaset)

HTH,
Q


Private Sub Postcode_AfterUpdate()
On Error GoTo Postcode_AfterUpdate_Err
Dim db As Database, rstAddress As Recordset
Set db = CurrentDb()
Set rstAddress = db.OpenRecordset("Select * From
qryaddresses
Where [post Code] = " & " '" & Me![Postcode] & "'",
dbOpenDynaset)
Street = rstAddress![Street]
PAO = rstAddress![PAO]
SAO = rstAddress![SAO]
Town = rstAddress![Town]
Me![PAO].SetFocus
rstAddress.Close
Set db = Nothing
Postcode_AfterUpdate_Exit:
Exit Sub
Postcode_AfterUpdate_Err:
Select Case Err.Number
Case Else
MsgBox Err.Description
Resume Postcode_AfterUpdate_Exit
Resume
End Select
End Sub

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account fromhttp://www.teranews.com- Hide quoted text -

- Show quoted text -
Hi Bob many thanks for your help. I'm getting a syntax error on line:-

stSQL = stSQL & Where [post Code] = " & " '"

Many Thanks
Phil

Aug 15 '07 #6
On 15 Aug, 00:04, "Len Robichaud" <len.robich...@rqwproserv.com>
wrote:
Try this. Your Where statement quotes were incorrect. I moved them outside
of the Open command for readability.

Private Sub Postcode_AfterUpdate()
On Error GoTo Postcode_AfterUpdate_Err
Dim db As Database, rstAddress As Recordset
Dim strSQL as String

strSQL = "Select * From qryaddresses " _
&"Where [Post Code] = '" & Me!PostCode & "'"

Set db = CurrentDb()
Set rstAddress = db.OpenRecordset strSQL, dbOpenDynaset
Street = rstAddress![Street]
PAO = rstAddress![PAO]
SAO = rstAddress![SAO]
Town = rstAddress![Town]
Me![PAO].SetFocus
rstAddress.Close
Set db = Nothing

Postcode_AfterUpdate_Exit:
Exit Sub

Postcode_AfterUpdate_Err:
Select Case Err.Number
Case Else
MsgBox Err.Description
Resume Postcode_AfterUpdate_Exit
Resume
End Select

End Sub

Len Robichaud
thank you for your help. it is much appreciated.
The answer was to knock the dynaset out:-

Set rstAddress = db.OpenRecordset(strSQL)

Why it works in one database and not the other I don't know.
Thanks again for your help.
Phil

Aug 15 '07 #7
On Aug 15, 10:39 am, Philip_coll...@lineone.net wrote:
On 14 Aug, 22:31, Bob Quintal <rquin...@sPAmpatico.cawrote:


Philip_coll...@lineone.net wrote innews:11*********************@w3g2000hsg.googlegr oups.com:
Hi folks!
I have pasted some code from anothere Db that works. the only
thing thats changed is the field names and the query. I then
get the above?? I am completely stumped the references are the
same and one works on the same computer and the other doesn't.
the following is the code that does'nt.
Tia
Phil
That error often indicates that Jet has failed to digest the
SQL. Check for typos in field names, missing spaces, etc.
A handy way to debug is to first build the SQL into a variable,
so you can debug.print it.
Dim stSQL as string
stSQL = "SELECT * FROM qryAddresses WHERE "
stSQL = stSQL & Where [post Code] = " & " '"
stSQL = stSQL & Me!Postcode & "'"
debug.print stSQL
Set rstAddress = db.OpenRecordset(stSQL,dbOpenDynaset)
HTH,
Q
Private Sub Postcode_AfterUpdate()
On Error GoTo Postcode_AfterUpdate_Err
Dim db As Database, rstAddress As Recordset
Set db = CurrentDb()
Set rstAddress = db.OpenRecordset("Select * From
qryaddresses
Where [post Code] = " & " '" & Me![Postcode] & "'",
dbOpenDynaset)
Street = rstAddress![Street]
PAO = rstAddress![PAO]
SAO = rstAddress![SAO]
Town = rstAddress![Town]
Me![PAO].SetFocus
rstAddress.Close
Set db = Nothing
Postcode_AfterUpdate_Exit:
Exit Sub
Postcode_AfterUpdate_Err:
Select Case Err.Number
Case Else
MsgBox Err.Description
Resume Postcode_AfterUpdate_Exit
Resume
End Select
End Sub
--
Bob Quintal
PA is y I've altered my email address.
--
Posted via a free Usenet account fromhttp://www.teranews.com-Hide quoted text -
- Show quoted text -

Hi Bob many thanks for your help. I'm getting a syntax error on line:-

stSQL = stSQL & Where [post Code] = " & " '"

Many Thanks
Phil- Hide quoted text -

- Show quoted text -
I forgot to add a quotation mark when I pasted your code.
Cleaned up version is
Dim stSQL as string
stSQL = "SELECT * FROM qryAddresses WHERE "
stSQL = stSQL & "[post Code] = '"
stSQL = stSQL & Me!Postcode & "'"

Aug 15 '07 #8
On 14 Aug, 22:31, Bob Quintal <rquin...@sPAmpatico.cawrote:
Philip_coll...@lineone.net wrote innews:11*********************@w3g2000hsg.googlegr oups.com:
Hi folks!
I have pasted some code from anothere Db that works. the only
thing thats changed is the field names and the query. I then
get the above?? I am completely stumped the references are the
same and one works on the same computer and the other doesn't.
the following is the code that does'nt.
Tia
Phil

That error often indicates that Jet has failed to digest the
SQL. Check for typos in field names, missing spaces, etc.

A handy way to debug is to first build the SQL into a variable,
so you can debug.print it.

Dim stSQL as string
stSQL = "SELECT * FROM qryAddresses WHERE "
stSQL = stSQL & Where [post Code] = " & " '"
stSQL = stSQL & Me!Postcode & "'"
debug.print stSQL
Set rstAddress = db.OpenRecordset(stSQL,dbOpenDynaset)

HTH,
Q


Private Sub Postcode_AfterUpdate()
On Error GoTo Postcode_AfterUpdate_Err
Dim db As Database, rstAddress As Recordset
Set db = CurrentDb()
Set rstAddress = db.OpenRecordset("Select * From
qryaddresses
Where [post Code] = " & " '" & Me![Postcode] & "'",
dbOpenDynaset)
Street = rstAddress![Street]
PAO = rstAddress![PAO]
SAO = rstAddress![SAO]
Town = rstAddress![Town]
Me![PAO].SetFocus
rstAddress.Close
Set db = Nothing
Postcode_AfterUpdate_Exit:
Exit Sub
Postcode_AfterUpdate_Err:
Select Case Err.Number
Case Else
MsgBox Err.Description
Resume Postcode_AfterUpdate_Exit
Resume
End Select
End Sub

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account fromhttp://www.teranews.com- Hide quoted text -

- Show quoted text -
Thank you for you help and your time.
Regards
Phil

Aug 17 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bill | last post by:
I call a function in my .js file like this: onClick="location.href='blank.html' + generateSearchStringFromForm('section')" where section is the name of my form. The function is defined as...
5
by: andy.herrera | last post by:
I'm getting this Error Message. Expected ';' Please Select One: <form name="form1"> <<------------ Error is here. <select name="selectTrans" onChange="If (this.value == 'checkout')...
3
by: Jon | last post by:
I'm learning about datatables. When using the example provided by MS in the ..NET Framework Class Library for DATATABLE (see below) I get an error on line 3 that says "Type expected". Is something...
7
by: Warrax | last post by:
I am currently doing online tutorials for C++, and am pretty much stuck in a rut about this problem. It is saying that there's an expected unqualifed-id before '{' token (I will post the code in just...
1
by: JOJO123 | last post by:
I got here in search of an answer to this Javascrpt question. I upgraded jave on XP Ie 7, acrobat 5.1 and suddenly can't open any pdf files on web sites using IE. I see u guys all say, this is a...
6
by: Lawrence Spector | last post by:
I ran into a problem using g++. Visual Studio 2005 never complained about this, but with g++ I ran into this error. I can't figure out if I've done something wrong or if this is a compiler bug. ...
5
by: amitmool | last post by:
hi, i have used the queue library file and try to use the template as template <class QueueItem> queue <QueueItem>::~queue() // line 25 { } template <class QueueItem> void...
1
by: Hunternora | last post by:
I'm just trying to count letters, by type etc. What am I doing wrong here? import javax.swing.JOptionPane; public class Asg3 { public static void main(String args) { int aCount=0,...
10
by: preeya | last post by:
Hi, I have written the following program: ------------------------------------------------------------------------------------------------------------- 1 #include <stdio.h> 2 #include...
9
by: erictheone | last post by:
Ok so what I'm trying to do is create a trans location cipher. For those among us that don't know alot about cryptography it is a method for jumbling up letters to disguise linguistic...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.