472,777 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Parenthesis doesn't work for referencing query fields

have a query which gets data from two tables.
There's about 20 fields worth of data.

In VB code, I run this query:

strPOItems = "SELECT * FROM [Order Details] LEFT JOIN
OutstandingInvoices ON ([Order Details].PartNumber =
OutstandingInvoices.PartN) AND ([Order Details].OrderNo =
OutstandingInvoices.PONumber) AND ([Order Details].ItemNo =
OutstandingInvoices.ItemNo) AND ([Order Details].SubOrder =
OutstandingInvoices.POSuborder) AND ([Order Details].TypeID =
OutstandingInvoices.TypeID) WHERE ((([Order Details].OrderNo)= " &
ready!OrderNo & ") AND (([Order Details].SubOrder)=""A"") AND
((OutstandingInvoices.ItemNo) Is Null) AND
((OutstandingInvoices.POSuborder) Is Null) AND
((OutstandingInvoices.PONumber) Is Null) AND
((OutstandingInvoices.PartN) Is Null) AND
((OutstandingInvoices.TypeID) Is Null));"
Set POItemsQuery = m.CreateQueryDef("", strPOItems)
Set POItems = POItemsQuery.OpenRecordset
When I want to store the data into another table I'm having problems
referencing the data.

For example:

Invoice!TypeID = POItems!TypeID

Gives me a 3265 runtime error.

So when I changed the line to this:

Invoice!TypeID = POItems![Order Details].TypeID

It gives me the error "Method or data member not found"
I would like to know what the correct syntax is to address the query
result.
Thankyou.


Nov 12 '05 #1
1 1796
sinthreck wrote:
have a query which gets data from two tables.
There's about 20 fields worth of data.

In VB code, I run this query:

strPOItems = "SELECT * FROM [Order Details] LEFT JOIN
OutstandingInvoices ON ([Order Details].PartNumber =
OutstandingInvoices.PartN) AND ([Order Details].OrderNo =
OutstandingInvoices.PONumber) AND ([Order Details].ItemNo =
OutstandingInvoices.ItemNo) AND ([Order Details].SubOrder =
OutstandingInvoices.POSuborder) AND ([Order Details].TypeID =
OutstandingInvoices.TypeID) WHERE ((([Order Details].OrderNo)= " &
ready!OrderNo & ") AND (([Order Details].SubOrder)=""A"") AND
((OutstandingInvoices.ItemNo) Is Null) AND
((OutstandingInvoices.POSuborder) Is Null) AND
((OutstandingInvoices.PONumber) Is Null) AND
((OutstandingInvoices.PartN) Is Null) AND
((OutstandingInvoices.TypeID) Is Null));"
Set POItemsQuery = m.CreateQueryDef("", strPOItems)
Set POItems = POItemsQuery.OpenRecordset
When I want to store the data into another table I'm having problems
referencing the data.

For example:

Invoice!TypeID = POItems!TypeID

Gives me a 3265 runtime error.

So when I changed the line to this:

Invoice!TypeID = POItems![Order Details].TypeID

It gives me the error "Method or data member not found"
I would like to know what the correct syntax is to address the query
result.
Thankyou.


Near as I can determine TypeID is contained in OutstandingInvoices and
is not included as a field column in the query. Could that be your
problem? That you forgot to add it to the query? If you did forget,
that can be fixed by adding that field to the SQL statement.

Nov 12 '05 #2

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

Similar topics

9
by: crispy | last post by:
I am sorry about posting such an elementary question, but I just can't get this to work: <%if (Recordset1.Fields.Item("notes").Value)="" then%> <%else%> <tr><td>Additional notes:...
11
by: Julian | last post by:
Hi I have code in my login.asp which sets the online field in user database to true or 1. I am trying to use the same code in global.asa to change back the online field to 0 but it doesn't work....
1
by: loRdK | last post by:
Hi, I have a database stored in MS SQL 2000 and an application written in VB5, which connects the database via JET/ODBC. I have a problem with the UNION statement.
7
by: AnnMarie | last post by:
My JavaScript Form Validation doesn't work at all in Netscape, but it works fine in IE. I made some of the suggested changes which enabled it to work in IE. I couldn't make all the changes...
19
by: David Thielen | last post by:
Hi; If there are no namespaces this works fine for me. But if the xml has namespaces, then I get either no node back or an exception. Here is the sample xml: <root xmlns="http://www.test.org"...
2
by: Matthew Wells | last post by:
I want to delete records from the "one" table of a one to may relationship. There are no actual Access relationships set up. The "one" table has a single field PK and the "many" table has a two...
10
by: Mr. x | last post by:
Hello, I have some code as follows. It seems that customValidator doesn't work - because i don't get any message. In the body : <asp:table> <asp:TableRow>
5
by: Shimon Sim | last post by:
I just don't understand what is wrong. I have simple query. One of the returning fields is data I created bound column for GridView (ASP.NET 2.0) and specified DataFormatString as {0:d} - it...
4
by: myemail.an | last post by:
Hi all, I use Access 2007 and have the following problems: when exporting banal select queries (either to Excel or to a csv file) I find that exporting often doesn't work and creates a file with...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.