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  

Help with code to run query and test a field in the record



 
 
Thread Tools Display Modes
  #1  
Old April 29th, 2004, 11:13 PM
Kate
external usenet poster
 
Posts: n/a
Default Help with code to run query and test a field in the record

Tried the following and get the message too few parameters
expected 3. The following statement gets highlighted:

Set rs = db.OpenRecordset("QueryAv")

Any idea? Thanks


Dim db As DAO.Database
Dim rs As DAO.Recordset

Set db = CurrentDb()
Set rs = db.OpenRecordset("QueryAv")

If rs![Booking ID] = 1 Then
DoCmd.OpenForm "SINGLE BOOKING DETAIL"
End If

rs.Close : Set rs = Nothing
Set db = Nothing


MVP [MS Access]


  #2  
Old April 30th, 2004, 03:07 AM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default Help with code to run query and test a field in the record

Post the SQL String of your QueryAv.

Do you use Parameters in this Query?

If you do, you need to resolve the Parameters before passing to JET for
processing.

--
HTH
Van T. Dinh
MVP (Access)


"Kate" wrote in message
...
Tried the following and get the message too few parameters
expected 3. The following statement gets highlighted:

Set rs = db.OpenRecordset("QueryAv")

Any idea? Thanks


Dim db As DAO.Database
Dim rs As DAO.Recordset

Set db = CurrentDb()
Set rs = db.OpenRecordset("QueryAv")

If rs![Booking ID] = 1 Then
DoCmd.OpenForm "SINGLE BOOKING DETAIL"
End If

rs.Close : Set rs = Nothing
Set db = Nothing


MVP [MS Access]




  #3  
Old April 30th, 2004, 03:20 AM
tina
external usenet poster
 
Posts: n/a
Default Help with code to run query and test a field in the record

hi Van.
Kate did post the SQL, in a separate thread 3:59 pm this date, subject line:
I'm struggling with my limited knowledge of code.
i posted an answer, but maybe you'll come up with something better on
looking at it?
tina


"Van T. Dinh" wrote in message
...
Post the SQL String of your QueryAv.

Do you use Parameters in this Query?

If you do, you need to resolve the Parameters before passing to JET for
processing.

--
HTH
Van T. Dinh
MVP (Access)


"Kate" wrote in message
...
Tried the following and get the message too few parameters
expected 3. The following statement gets highlighted:

Set rs = db.OpenRecordset("QueryAv")

Any idea? Thanks


Dim db As DAO.Database
Dim rs As DAO.Recordset

Set db = CurrentDb()
Set rs = db.OpenRecordset("QueryAv")

If rs![Booking ID] = 1 Then
DoCmd.OpenForm "SINGLE BOOKING DETAIL"
End If

rs.Close : Set rs = Nothing
Set db = Nothing


MVP [MS Access]






  #4  
Old April 30th, 2004, 03:55 AM
Van T. Dinh
external usenet poster
 
Posts: n/a
Default Help with code to run query and test a field in the record

Yes.

There are 3 Parameters that need to be resolved before passing the SQL
String to JET for processing. They a

Forms![SINGLE BOOKING AVAILABILITY]!BookingDate
Forms![SINGLE BOOKING AVAILABILITY]!Combo8
Forms![SINGLE BOOKING AVAILABILITY]!Combo10

Note that JET Database Engine which process the SQL String does not know
anything about Forms or Controls on Form so these need to be replaced with
actual values before passing the SQL String to JET for processing.

--
HTH
Van T. Dinh
MVP (Access)


"tina" wrote in message
...
hi Van.
Kate did post the SQL, in a separate thread 3:59 pm this date, subject

line:
I'm struggling with my limited knowledge of code.
i posted an answer, but maybe you'll come up with something better on
looking at it?
tina




 




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


All times are GMT +1. The time now is 11:42 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.