Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] For Loop
 Login/Join
 
Member
posted
Can someone help me put a "for loop" around this thing. Time is of essence and I don't have any right now to learn. Thanks
-----
Private Sub cmdKeyRecord_Click()
DoCmd.GoToRecord , , acFirst
AppActivate "tnd06h.hertz.com", True
SendKeys "{F7}", True
SleepX (1000)
SendKeys Me.Area, True
If Len(Me.Area) <> 5 Then
SendKeys "{TAB}", True
End If
SendKeys Me.PO, True
If Len(Me.PO) <> 7 Then
SendKeys "{TAB}", True
End If
SendKeys Me.Item1, True
If Len(Me.Item1) <> 4 Then
SendKeys "{TAB}", True
End If
SendKeys Me.Item2, True
If Len(Me.Item2) <> 4 Then
SendKeys "{TAB}", True
End If
SendKeys "{F8}", True
SleepX (2000)
SendKeys "+{TAB 4}", True
SendKeys Me.MFG, True
If Len(Me.MFG) <> 3 Then
SendKeys "{TAB}", True
End If
SendKeys Me.NewModel, True
If Len(Me.NewModel) <> 8 Then
SendKeys "{TAB}", True
End If
SendKeys Me.MY, True
SendKeys "{END}", True
SendKeys "+{TAB}", True
SendKeys Me.RequestedBy, True
If Len(Me.RequestedBy) <> 16 Then
SendKeys "{TAB}", True
End If
SendKeys Me.Reason, True
SendKeys "{F6}", True
SleepX (2000)
SendKeys "{F7}", True
Me.Done = True
DoCmd.Requery
End Sub

This message has been edited. Last edited by: Kerry,


Web Focus Developer Studio Release 7.6.1 Output formats include Excel, PDF, HTML, XML.
 
Posts: 25 | Registered: September 05, 2008Report This Post
Virtuoso
posted Hide Post
Is this Visual Basic ??




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Member
posted Hide Post
Yes, VB macro set up in MS Access. Currently I click a button which runs through one record in the database. I want to set this up to run through a number of records before it stops. I have other things I must get done and am stuck here clicking this button every 4 seconds or so. Thanks much.


Web Focus Developer Studio Release 7.6.1 Output formats include Excel, PDF, HTML, XML.
 
Posts: 25 | Registered: September 05, 2008Report This Post
Expert
posted Hide Post
TimpyJane,

This is WebFOCUS forum, you will have better luck at a VisualBasic forum, non?


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
Timpy, I'm sure this will solve all your problems. Enclose your code in this loop:

-REPEAT FORLOOP X TIMES;

-FORLOOP

Problem solved, no? Please let us know if this resolved your problem.


______________________
WF Version: Prod/Test : WebFOCUS 7.67; ETL 7.67

OP system: WIN2K
 
Posts: 18 | Registered: June 28, 2006Report This Post
Virtuoso
posted Hide Post
The suggestion you have got from bcowley is a perfect webfocus answer, but since you ask for a Access VB looping that will not work.

try something like this

Do while Not rst.EOF
        If rst![MyField] <> Something Then  'The real loop exit condition.
            Exit Do
        End If
        ' Rest of your code here.
        rst.MoveNext
Loop


look at this site

http://www.everythingaccess.com




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Silver Member
posted Hide Post
Private Sub cmdKeyRecord_Click()
Dim timesToLoop = 100
For count = 0 to timesToLoop
DoCmd.GoToRecord , , acFirst
AppActivate "tnd06h.hertz.com", True
SendKeys "{F7}", True
SleepX (1000)
SendKeys Me.Area, True
If Len(Me.Area) <> 5 Then
SendKeys "{TAB}", True
End If
SendKeys Me.PO, True
If Len(Me.PO) <> 7 Then
SendKeys "{TAB}", True
End If
SendKeys Me.Item1, True
If Len(Me.Item1) <> 4 Then
SendKeys "{TAB}", True
End If
SendKeys Me.Item2, True
If Len(Me.Item2) <> 4 Then
SendKeys "{TAB}", True
End If
SendKeys "{F8}", True
SleepX (2000)
SendKeys "+{TAB 4}", True
SendKeys Me.MFG, True
If Len(Me.MFG) <> 3 Then
SendKeys "{TAB}", True
End If
SendKeys Me.NewModel, True
If Len(Me.NewModel) <> 8 Then
SendKeys "{TAB}", True
End If
SendKeys Me.MY, True
SendKeys "{END}", True
SendKeys "+{TAB}", True
SendKeys Me.RequestedBy, True
If Len(Me.RequestedBy) <> 16 Then
SendKeys "{TAB}", True
End If
SendKeys Me.Reason, True
SendKeys "{F6}", True
SleepX (2000)
SendKeys "{F7}", True
Me.Done = True
DoCmd.Requery
Next



End Sub


That should work for you, just change the timesToLoop value to the number of loops you need.


7.6.6 Mainframe
7.6.4 Web Focus
Windows

 
Posts: 45 | Location: Gaffney SC | Registered: March 30, 2007Report This Post
Member
posted Hide Post
Lucas, I'm getting an error on the Dim timesToLoop = 100 as follows:

Compile error:
Syntax error

Any ideas?
Thanks


Web Focus Developer Studio Release 7.6.1 Output formats include Excel, PDF, HTML, XML.
 
Posts: 25 | Registered: September 05, 2008Report This Post
Silver Member
posted Hide Post
quote:
Dim timesToLoop = 100
For count = 0 to timesToLoop


Just change it to
For count = 0 to 100
and lose the "Dim timesToLoop = 100" all together.

You could also make it
timesToLoop = 100
For count = 0 to timesToLoop
and just remove the "Dim", that should work to.

The "timesToLoop = 100" is just the upper limit on the for loop limiting the number of times you want to loop.


7.6.6 Mainframe
7.6.4 Web Focus
Windows

 
Posts: 45 | Location: Gaffney SC | Registered: March 30, 2007Report This Post
Member
posted Hide Post
I found this to work somewhat:

Dim LoopCounter As Integer
LoopCounter = 2
While LoopCounter < 4

[coding]

LoopCounter = LoopCounter + 1
Wend
End Sub
----
I set it to 2 as a test. First record updates just fine, but the job won't pull in the second record until I click anywhere on the Access database, which is probably something about which application has focus. Thus, the loop isn't buying me anything. Any ideas? We're gonna get this yet Red Face)


Web Focus Developer Studio Release 7.6.1 Output formats include Excel, PDF, HTML, XML.
 
Posts: 25 | Registered: September 05, 2008Report This Post
Virtuoso
posted Hide Post
I developed many access applications, but never created an update script this way.
it reminds me of the old days when I created macros for lotus 1-2-3. (one of the first spreadsheet programs)
I would try to create an real update query instead.

Did you search the internet for a better support site on access?




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Member
posted Hide Post
Hi Frank. I searched for a forum site and am just about finished with the register part.

I appreciate everyone's input. I knew I could get some help here - lots of good folks.

Timpy


Web Focus Developer Studio Release 7.6.1 Output formats include Excel, PDF, HTML, XML.
 
Posts: 25 | Registered: September 05, 2008Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders