Re: Help with while ...loop Statements

From: Bre-x (cholotron_at_hotmail.com)
Date: 11/30/04


Date: Mon, 29 Nov 2004 19:00:34 -0700

Graham, thanks for answering my question

Yes, tt does not return a value, doesnt have to. But it accomplish what I
need.

It's partial shipment DB.

The user enter a Sales Order Number
Sales Order is displayed.
for each Sales Order Line that is marked (R Field)
my function send a insert and update statement to a Pervasive SQL Server.

I am been able to accomplish it by running a Make Table Query ( this query
has my function).

Believe it works fine.

But the only way I am able to find out what Sales Orders been marked to be
ship is by running this query.

I am pretty sure there is a way to read the Sales Order Line Table go into
each record, check the R Field
and every time it is marked (-1) send my Insert and Update sql scripts to
the sql server

Regards,

Bre-x

----- Original Message -----
From: "Graham R Seach" <gseach@NOSPAMpacificdb.com.au>
Newsgroups: microsoft.public.access.gettingstarted
Sent: Monday, November 29, 2004 6:39 PM
Subject: Re: Help with while ...loop Statements

> doSHP() doesn't return a value, so it's use in the SELECT INTO query
doesn't
> quite do what you think it does.
>
> What are you really trying to do?
>
> Regards,
> Graham R Seach
> Microsoft Access MVP
> Sydney, Australia
>
> Microsoft Access 2003 VBA Programmer's Reference
> http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
>
>
> "Bre-x" <cholotron@hotmail.com> wrote in message
> news:OO71Lun1EHA.2016@TK2MSFTNGP15.phx.gbl...
> > Hi,
> >
> > I have a table where there's a "R" field (Yes/No Type)
> > For every record where R equals to -1 I have a function that do
> > "something"
> >
> > I am able to accomplish this by creating a query with a function on it
> >
> > But couldn't I accomplish this with a while..loop or for....each
> > statement?
> >
> > How to I read my table and go into each record and read the "R" Field?
> >
> >
> > Thank you All
> >
> > Bre-x
> >
> >
> > 'Here is the Query
> > SELECT SOL.SONUM, SOL.L, SOL.MS, SOL.R, SOL.RQTY,
> > doSHP([SONUM],[L],[R],[RQTY]) AS DoSHPFunction INTO Temp
> > FROM SOL;
> >
> > 'Here is the Function
> > Function doSHP(SONUM, SOLINE, R, RQTY)
> > If R = -1 Then
> > If RQTY = 0 Then
> > MsgBox "Sales Order: " & SONUM & " " & Chr(10) & "Line: " & SOLINE
&
> > Chr(10) & "This line will not be process"
> > Exit Function
> > End If
> >
> > RText = "Sales Order: " & SONUM & " " & Chr(10) & "Line: " & SOLINE &
> > Chr(10) & "Ready to Process?"
> > Responce = MsgBox(RText, vbInformation + vbYesNo, cianame())
> > If Responce = vbYes Then
> > sqlString = "INSERT INTO PS_HST ( SONUM, SOLINE, QTY, SHIPPER,
> > SHIPDATE, SHIPTIME ) VALUES (" & SONUM & "," & SOLINE & "," & RQTY & ",
'"
> > &
> > dhGetUserName() & "', CURDATE ( ), CURTIME ( ))"
> > INSERT_SHP (sqlString)
> > sqlString = "SELECT COUNT(SONUM) AS SO FROM PS_SHP WHERE SONUM =
"
> > &
> > SONUM & " AND SOLINE = " & SOLINE
> > CurrentDb.QueryDefs("Server_GETTSHP").SQL = sqlString
> > If DLookup("[SO]", "Server_GETTSHP") = 0 Then
> > sqlString = "INSERT INTO PS_SHP ( SONUM, SOLINE, TSHP )
VALUES
> > (" & SONUM & "," & SOLINE & "," & RQTY & " )"
> > INSERT_SHP (sqlString)
> > Else
> > sqlString = "SELECT TSHP FROM PS_SHP WHERE SONUM = " & SONUM
&
> > "
> > AND SOLINE = " & SOLINE
> > CurrentDb.QueryDefs("Server_GETTSHP").SQL = sqlString
> > NQ = RQTY + DLookup("[TSHP]", "Server_GETTSHP")
> > sqlString = "UPDATE PS_SHP SET TSHP = " & NQ & " WHERE SONUM
=
> > "
> > & SONUM & " AND SOLINE = " & SOLINE
> > INSERT_SHP (sqlString)
> > End If
> > Else
> > End If
> > Else
> > End If
> > End Function
> >
> >
>
>



Relevant Pages

  • Re: Help with while ...loop Statements
    ... Microsoft Access 2003 VBA Programmer's Reference ... But it accomplish what I ... > The user enter a Sales Order Number ... > I am been able to accomplish it by running a Make Table Query (this query ...
    (microsoft.public.access.gettingstarted)
  • Re: Show results whilst processing
    ... You probably need to program asynchronously against SQL Server in order to accomplish that. ... do that depends on what database API you are using. ... Note, however, that SQL Server can decide to do intermediate processing of a query, like sorting ...
    (microsoft.public.sqlserver.server)
  • grouping for query example on pages 123-4 of your book
    ... I've been trying for hours to modify the Theater Freq probablility prediction query on pages 123-4 of Data Mining with SQL Server 2005 to accomplish two changes: ... Instead of the query returning results just for customers with Theater Freq values of Monthly and Rarely, I would like it to return results for those who are Weekly, Daily, and Never, too. ...
    (microsoft.public.sqlserver.datamining)
  • Link Tables
    ... , I can create a query that joins ... How can I accomplish this inside SQL Server? ... Bill ...
    (microsoft.public.sqlserver.dts)
  • Link SQL Server Tables
    ... , I can create a query that joins ... How can I accomplish this inside SQL Server? ... Bill ...
    (microsoft.public.sqlserver.dts)