Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Previous && Next Buttons


Hi All

I'm not sure if this should be in this forum because its about buttons or the database forum because it contains a database so feel free to move it

Im trying to code the next and previous buttons without success

Can someone please take a quick look for me - Thanks

P.S also the lblCurrentRecord isn't working




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Next/Previous Buttons On MMcontrol
Private Sub MMControl1_NextClick(Cancel As Integer)
MSHFlexGrid1.CellBackColor = &H8000000E
MSHFlexGrid1.Row = MSHFlexGrid1.Row + 1
MSHFlexGrid1.CellBackColor = &HFFFF&
MMControl1.Command = "Close"
PlayClick
End Sub


Private Sub MMControl1_PlayClick(Cancel As Integer)
PlayClick
End Sub

Private Sub MSHFlexGrid1_Click()
MMControl1.Command = "Close"
PlayClick
End Sub

Private Sub MSHFlexGrid1_DblClick()
MMControl1.Command = "Close"
PlayClick
End Sub

Private Sub PlayClick()
If Left(MSHFlexGrid1.Text, 2) = "G-" Then
MMControl1.FileName = Path & Right(MSHFlexGrid1.Text, Len(MSHFlexGrid1.Text) - 2)
Else
MMControl1.FileName = Path & MSHFlexGrid1.Text
End If
MMControl1.Command = "Open"
MMControl1.Command = "Play"
End Sub

If I click on the cell and then click the play button on the mmcontrol, file will play

If I double click on the cell, the file will play

If I click next on the MMcontrol, the file shows as playing, but no sound is heard

What am I missing here?
what would really be nice is some example code of the next/previous buttons for the MMcontrol. I've looked alot for such code and all I see are examples of the play button.

Not Moving With First, Next, Previous && Last Buttons
Friends,

It shows like the following. But not moving with the firs, next, previous & last buttons.

1 of 5

If I have moved to second record using NEXT button also it shows just the same : 1 of 5.

The following is the code:

rs.Open "Select * from TOTALSTBL1 Order By SL", db, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
rs.MoveFirst
Text104.Text = "Record " & rs.AbsolutePosition & " of " & rs.RecordCount
End If

Coding For Next, Previous Buttons
hi
i'm using a database on acess and linking it to a vb form
i have created buttons for next, previous, first and last records
i'm not sure of the coding for each of the buttons
can anyone help me pls

Previous, Next, Add, Delete Buttons On An User Form?
I have an User Form designed for data entry and data manipulation. When enter data I use 4 text boxes (4 in the row) and transfer it to the active worksheet. Total number of rows is 20 starting from row 25.

What is wrong with my code? I cannot move foreward. Clicking at either of three buttons (next, previous, add and delete) I get an error message in the subroutine
Private Sub SaveRow()

and the row >

Cells(ICurrentRow, 34).Value = TextBox1.Value

and clicking at ‘delete button I get error in this row > Rows(ICurrentRow).Delete

Anyone, please help to get this code fully functional !!!

Will be very much appreciated.

Danny



Dim ICurrentRow As Long

Private Sub CommandButton2_Click()
Unload Me
End Sub

Private Sub UserForm_Initialize()
ICurrentRow = 25
'Read Initial Values from Row 1 (in fact row 25)
LoadRow

TextBox1.SetFocus
End Sub

Private Sub CommandButton3_Click()
'Previouis Button
If ICurrentRow > 25 Then
SaveRow
ICurrentRow = ICurrentRow - 1
LoadRow
End If
End Sub

Private Sub CommandButton4_Click()
'Next Button
SaveRow
ICurrentRow = ICurrentRow + 1
LoadRow
End Sub
Private Sub CommandButton5_Click()
'Add Button
If Cells(25, 34).Value = "" Then
ICurrentRow = 25
Else
ICurrentRow = ActiveSheet.UsedRange.Rows.Count + 1
End If
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
SaveRow
TextBox1.SetFocus
ICurrentRow = ICurrentRow + 1
LoadRow
End Sub

Private Sub CommandButton6_Click()
Rows(ICurrentRow).Delete
LoadRow
End Sub

Private Sub CommandButton1_Click()
'Compute Button
SaveRow
End Sub

Private Sub LoadRow()

TextBox1.Value = Cells(ICurrentRow, 34).Value
TextBox2.Value = Cells(ICurrentRow, 18).Value
TextBox3.Value = Cells(ICurrentRow, 19).Value
TextBox4.Text = Cells(ICurrentRow, 21).Value
End Sub

Private Sub SaveRow()

Cells(ICurrentRow, 34).Value = TextBox1.Value
Cells(ICurrentRow, 18).Value = TextBox2.Value
Cells(ICurrentRow, 19).Value = TextBox3.Value
Cells(ICurrentRow, 21).Value = TextBox4.Text

End Sub

Code For MSHFlexGrid1 (FIRST, PREVIOUS, NEXT && LAST) Command Buttons
Dear Friends,

I am still searching for the code to move from one record to another in MSHFlexGrid. Could somebody help me out, please?

Margaret.

Previous-command Not Going To Previous File
hi guys

i ve a problem in previous command. when i click this button it goes to the first file of my recordset instead of going to previous record. for eg. A, B, C1 , D1, E1, F, G1. if iam in f record at this time when I press prevcmd. it goes to A instead of E1.

help me to correct this coding

Code:Private Sub cmdPrevious_Click()

If Not rstscene.BOF Then
rstscene.MoveFirst
  Call fill
MsgBox "Previous Panel"
End If
End Sub

Code:Sub fill()
Dim i As Integer
For i = 0 To 1
    If Not rstscene.EOF Then
        strPannelId(i) = rstscene.Fields("Panelid")
        panel_txt(i) = rstscene.Fields("Panel")
        Image1(i) = LoadPicture(App.Path & "images" & rstscene.Fields("filename"))
        action_txt(i).Text = rstscene.Fields("Action")
        dialogue_txt(i).Text = rstscene("dialogue")
   
End If
Next i
End Sub

thanks

Need Help Writing Code For Option Buttons/Radion Buttons
I'm a visual basic student and im trying to write a program for a friend to help him study. I want to have a question in a label, with a frame that has 4 option buttons in it, and a 'check' button and an 'exit' button and here's what someone helped me come up with, but it doesnt work

If optB.Checked = True Then
MessageBox ("Next Question!")
Else
MessageBox ("Why shake your yup yup! I think you should try again ;0)")
End If

written as code in check button

im using visual basic 6 and it gives me a compile error when i click the correct option button and then click on my check button and it highlights the '.checked' can anyone help me?

Option Buttons And Command Buttons On A Different Form
Hi all!

my problem is, im making a quiz setter/taker.

i have 1 form to set the questions and 1 form to take the test.

on the set form, i have 5 text boxes, 1 for the question and 4 for 4 possible answers. next to the 4 text boxes i have an option button to select for which the correct answer is.

then i press the save button and go to the test form.

there i have 1 text box and 4 command buttons. the 4 answers appear in the command buttons to click. which ever button is clicked, the button changes yellow to indicate the buttons has been selected.

then i press a submit button to reveal the correct answer.

what i want to do it make the option i selected, if the command button chosen is wrong or right then it will change either red or green.

this will be a small peice of code probably but ive been trying all night and cant figure it out

Radio Buttons + Drop Down Buttons.
Hi guys I have a simple program that when a user fills in a text box and then presses a command button it copies the text from text1 to another text "form" ..

now I have not used radio or drop down buttons I am sure its VERY simple .. but how to I do it so that when a radio button is checked it will do the same as the above as in copy it once a certain one is checked.

I am also looking for the same answer for dropdown menues.. once a certain once is selected it will copy it into a text box..
but with th drop down menu I also want once extra thing.

And my last question is I would like to know how, once a user selects a radio button "only one of them not for all" it will pop up a textbox asking for user input on the form.. for example
radio 1 (apples), radio 2(orage) radio 3 (specify) thanks for all the help..

Nelson

Previous Value
How can I get the value of a cell previous to its modification?

I need to find the previous value in some other sheets and modify them accordingly.

Thanks in advance.

Next,previous
Hi there

The attached file contains vb sample. I tried for previous and next, but i can't. if i click previo0us nothing, if i click next second record is only displayed not other all records. Actually what is problem?
any can help me please

by
yasi

Previous Tab
I need to know the current tab on a sstab1.
Is there is anyway to know that?
p.s.: How care about the previous tab?

Thank You For Previous Help. Two More Qs Though.
Thank you so much for the previous help on VB. One more question I do not understand. I am very sorry to pester with this one.

Write a function that takes a string parameter and returns an integer. The function should retunr 2 if the parameter matches the constants VALUE_1 or VALUE_2; 3 if it matches VALUE_3; 5 if it matches VALUE_4, VALUE_5, or VALUE_6; and I in all other cases.

Also, if you write a column with a negative sign in front of it that makes it alphabetically descending correct?

Thank you very much for all your help.

Next And Previous With ADO And DB2
Does anyone have experience reading DB2 tables through VB?
I am using the code below to connect to a table, but I can only go forward through the records. When I try to go back or to the end, I get Run Time Error '3219'. Operation is not allowed in this context.
I have tried adOpenDynamic, adOpenStatic, and adOpenKeyset.

Code:
Set cnn = New ADODB.Connection
Set rs = New ADODB.Recordset

cnn.Open "Provider=MSDASQL.1;Password=;" & _
"Persist Security Info=True;User ID=;" & _
"Data Source=DSND"

rs.CursorLocation = adUseServer
rs.CursorType = adOpenStatic
rs.LockType = adLockOptimistic
rs.ActiveConnection = cnn
rs.Open "Select * from TAX.VTAX_CHAR01"

Thanks for any ideas/suggestions.

TAB TO PREVIOUS
I am trying to accommodate a request that users would like to utilize a (shift + tab) combination to move to the previous control or field on the form.

Does anyone have any examples on how to handle this.

The only thing I can come up with is holding a variable through out the scope of the form. Each object will need a keypress event to see if the shift key is followed by the tab key.... Let me know if there is something easier.

Previous Folder Name
I am using dir to select the required folder. Apart from this current folder, I also need the previous folder (one level up) name. How can this be done?

Now, I am doing this by going thru current folder name and looking for "/". I am sure there could be smart alternatives to this.

Previous Instance?
I've tried everything, but this seems to keep messing up...

I'm using this code to close a program if it already has a previous instance...


Code:
If App.PrevInstance Then
MsgBox "Program Already Running"
Unload Me
End If

Every time I open the app the first time, it opens fine, nothing wrong...

The problem comes when I open it again, it doesn't close! And if I wait a few seconds, the second instance CRASHES!

I thought it might be code crashing or something, so I tried different things with the code, such as:


Code:
If App.PrevInstance = true Then
MsgBox "Program Already Running"
Unload Me
End If

and...


Code:
If App.PrevInstance = true Then
Unload Me
End If

and...


Code:
If App.PrevInstance Then
Unload Me
End If

I'm clueless, help me out please!

Previous/Next Files
This is part of the code which i have used on my slideshow problem. I am using Next&Previous Buttons in a toolbar to display either a previous or next pic, but for some reasson it is not working.

Code:
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)

If Button.Key = "Files" Then
SlideImage.Visible = False
Dir1.Visible = True
File1.Visible = True
DriveList.Visible = True
FileTypes.Visible = True

ElseIf Button.Key = "Show" Then
CurrentImage = 0
Do While CurrentImage < File1.ListCount
If File1.Selected(CurrentImage) Then
ShowImage CurrentImage
Exit Do
Else
CurrentImage = CurrentImage + 1
End If
Loop

ElseIf Button.Key = "Next" Then
CurrentImage = CurrentImage + 1
Do While CurrentImage < File1.ListCount
If File1.Selected(CurrentImage) Then
ShowImage CurrentImage
Exit Do
Else
CurrentImage = CurrentImage + 1
End If
Loop

ElseIf Button.Key = "Previous" Then
CurrentImage = CurrentImage - 1
Do While CurrentImage >= 0
If File1.Selected(CurrentImage) Then
ShowImage CurrentImage
Exit Do
Else
CurrentImage = CurrentImage - 1
End If
Loop

ElseIf Button.Key = "Stretch" Then
SlideImage.Stretch = Not SlideImage.Stretch
ShowImage CurrentImage

ElseIf Button.Key = "Exit" Then
Unload SlideShow

ElseIf Button.Key = "Reset" Then
ResetSettings

End If
End Sub
(Current Image is a variable)

Can Someone plz help me?
Raj

Help With Next And Previous Records
Hi, Im trying to access a database through vb and then import the results into a flash file, everything is working great except that i cant figure out how to do the next and previous records (10 at a time)

Here is my code below,
any help would be greatly appreciated


'beginning of code





Option Explicit

Public cnn As Connection 'connection to the database
Public rcst As Recordset 'data keeper



Private Sub cmdConnect_Click()
'connects to the database

Dim strCnn As String 'connection string
Dim intErr As Integer 'iteration var

On Error GoTo er

'every connection needs connection string:
strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & " est.mdb" & ";"

Set cnn = New Connection 'create new connection
cnn.ConnectionString = strCnn 'specify the connection string
cnn.Open 'open the connection
frmData.Caption = "Data Access - Connected"
cmdDisconnect.Enabled = True
cmdConnect.Enabled = False
Exit Sub
er:
If cnn.Errors.Count > 0 Then 'process all connection errors
For intErr = 0 To cnn.Errors.Count - 1
MsgBox "Error in Connection: " & cnn.Errors(intErr).Description, vbCritical, "Error"
Next intErr
Else 'process other errors
MsgBox "Error in cmdConnect", vbCritical, "Error"
End If
End Sub

Private Sub cmdDisconnect_Click()
On Error Resume Next
cnn.Close 'try to close the connection
Set cnn = Nothing 'clear the object
Set rcst = Nothing 'clear the recordset if it was init before
frmData.Caption = "Data Access - Disconnected"
cmdDisconnect.Enabled = False
cmdConnect.Enabled = True
End Sub




Private Sub xWin_FSCommand(ByVal command As String, ByVal args As String)



If command = "databox.getrecords" Then

Static recordnumber As Integer 'iteration var
'gets the First_Name field from the main table
Dim strSql As String ' use SQL syntax to obtain info
Dim flashtext As String ' use SQL syntax to obtain info
'recordnumber = 1

'check if connection was established
If cnn Is Nothing Then Exit Sub
If cnn.State = 0 Then Exit Sub

'sql statement that selects First_Name column from Main table
strSql = "SELECT First_Name FROM Main"

Set rcst = New Recordset 'recorset that will contain the data
rcst.CursorLocation = adUseClient
rcst.Open strSql, cnn 'gets the data

xWin.SetVariable "recordcount", "recordcount =" & rcst.RecordCount 'put records into flash
'output the info



''Form Level
Dim i As Integer
Static textboxrotation As Integer


''In Form_Load

i = 1

''In Button's _Click Event
Do While Not rcst.EOF 'check for the end
flashtext = rcst.Fields(0).Value
xWin.SetVariable "r" & i, flashtext
recordnumber = recordnumber + 1
rcst.MoveNext 'goto the next record
i = i + 1
''Divide it by 10, If the remainder is zero, then exit the sub
''and wait for the user to click again..
If recordnumber Mod 5 = 0 Then
Exit Do
Else
rcst.MoveNext



End If

Loop


rcst.Close
Set rcst = Nothing 'release the memory

End If


End Sub

Private Sub Form_Load()

'flash movie
frmData.ScaleMode = 3
xWin.Movie = App.Path & "Bounce.swf"
xWin.Left = 0
xWin.Top = 0
xWin.Width = 640
xWin.Height = 480
xWin.Play



Dim strCnn As String 'connection string
Dim intErr As Integer 'iteration var

On Error GoTo er

'every connection needs connection string:
strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & " est.mdb" & ";"

Set cnn = New Connection 'create new connection
cnn.ConnectionString = strCnn 'specify the connection string
cnn.Open 'open the connection
frmData.Caption = "Data Access - Connected"
cmdDisconnect.Enabled = True
cmdConnect.Enabled = False
Exit Sub
er:
If cnn.Errors.Count > 0 Then 'process all connection errors
For intErr = 0 To cnn.Errors.Count - 1
MsgBox "Error in Connection: " & cnn.Errors(intErr).Description, vbCritical, "Error"
Next intErr
Else 'process other errors
MsgBox "Error in cmdConnect", vbCritical, "Error"
End If



End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Set cnn = Nothing 'destroy object (prevent memory leaks)
Set rcst = Nothing
End Sub



'end of code



thanks

Previous Instance
I know about App.PreviousInstance but...

How do I make the previous instance receive the focus?

Previous Window
hey can anybody help me ? im trying to find out the previous focused window so my popup like msn wont have focus... or if u have any idea pls tell me

ADO -This Must Have A Previous Answer?
Hello,

I am useing ADODB - WithEvents to connect to an Access dB, all is fine and well.

I can select data to view but now I want to insert data, and here is my problem:

how do I go to the last record and add the new data?
now it writes over the data that aldready is in the dB.


Call assign ' checks that the data is in correct format
With Rs1
.MoveLast
.Save
.Update

thanks, this forum has been very helpfun

Previous FORM's Name
VB Code:
RESOLVED
Hi All,

In my application, a new form let it be form3 has to be opened if a button is clicked in either form1 or form2. In form3 I have to get the name of previously opened form i.e which form (eithre form1 or form2 opens this new form). How can i get this.

Thanks in advance.






Added [RESOLVED] to thread title - Hack

Change To Previous Dir
Hello,

CurDir : C:projectcom

I want to change to C:projectsinbound

How to do in VB

Thanks
vbraju

How To Go To Previous Tab (solved)
Hello

In my forms I use a Tabstrip (SSTab). Now, when I click on the second tab, I check some fields and when there is something wrong I want to go back to the first tab in code.

How to do?

I have tried many options, but can't find the correct one..

tnx!

nickname

Move.Previous Not EOF ?????
Theres something i find it odd when u specify a IF else to take care of the EOF during move previous i realised that it still move one more blank field b4 hiting the EOF or BOF is there anyway to take care of this???

Previous Instance
i have a program that uses command line args what i would like to do is if another instance is started that it tells the first what args it was sent and then closes. how can i do this

Move Next && Previous..
i am using ADO with adodc to connect to an access database..
i have two buttons.. Previous and Next

I coded my Previous button to belike this

VB Code:
Private Sub prevRes_Click()With Adodc1.RecordsetIf .BOF = False Then.MovePreviousElsefrmMmenu.StatusBar1.Panels(1) = "No more records."End IfEnd WithEnd Sub


Next button like this

VB Code:
Private Sub nextRes_Click()With Adodc1.RecordsetIf .EOF = False Then.MoveNextElsefrmMmenu.StatusBar1.Panels(1) = "No more records."End IfEnd WithEnd Sub


the code works of course.... the problem is every time i click previous until the first record.. then i click previous again.. it will bring me to a blank record b4 the first record.. and clicking another time will trigger my status bar to display the message.

same to next button of coz.. and when i press Delete record button at that 'blank' record before first or last record, an error message would appear.. how do i overcome that?

Close Previous
if i run my program again, i like the previous to close.

Previous Instances
i have the following code which loads the form if the form is minimised and it works if a do not put anything on the form .this code is on a module. If i put a 'call procedes' on the form load if loads another program
does anyone know how to stop which. i need the call function on the form load.

help????????


Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_SHOWNORMAL = 1

Private xhwnd As Long

Sub Main()
Dim xAppName, xMsg As String

If App.PrevInstance Then

xAppName = "TestForm1"

xhwnd = FindWindow(0&, xAppName)
If xhwnd <> 0 Then
AppActivate xAppName
xhwnd = ShowWindow(xhwnd, SW_SHOWNORMAL)
End
End If
End If

Load frmPrevInstance
frmPrevInstance.Show
End Sub

Next Record And Previous
When I click on combo2...it displays all records in the required fields...I want to move to the next record that macthes the individual field name which is devname...and vice versa with the previous command.

Private Sub Combo2_Click()
Dim myclass As New clsDB
Dim sSQL As String

sSQL = "select * from projectinfo"


myclass.GetMyData sSQL

myclass.rsMyData.MoveFirst
Do While Not myclass.rsMyData.EOF
If myclass.rsMyData!devname = Combo2.Text Then
TxtDeveloperID.Text = myclass.rsMyData!developerID
Combo7.Text = myclass.rsMyData!devname
' TxtName.Text = myclass.rsMyData!devname
TxtPhone.Text = myclass.rsMyData!phone
Combo6.Text = myclass.rsMyData!requesttitle

Looking For Previous Article
hi, i was opening an vb question in the forums and suddenly my IE crashed and then windows crashed ... i never got to see the question and the next day i came to look at it i couldn't find it ...

if i remember, the subject was about aligning another form to the first form ...

the reason i want to see this question is because i would like to see if anyone responded to it so i can have it handy whenever i might need to something like that

so anyone have the link to that?

About My Previous Posts....
Forget them, I was able to do everything almost perfectly with one exception, it still won't write it to the file like it is seen on screen which is what I've been trying to do.
I believe it is impossible without a considerable amount of user interaction and time. The TreeView control cannot do what I want it to do.

I have only one more question to pose to you...
Does anyone out there know of any kind of treeview type controls out there that when you invoke the .Next property will actually go to the Next node down? instead of going down the index?

Oh, Well, 3 months wasted learning how to use a control that won't do it right!
I now have 2 very capable routines that do the same thing wrong. I was hoping that I wouldn't have to implement a text search and insert routine as using the treeview would have made a much nicer user interface. Nothing like making a 2mb text editor!

Thanks for reading, I had to vent a little.

Sub Should Wait For Previous One
I need a way to run subs/functions one after the other BUT make each wait untill the previous is finished.

Example:

private sub ProccessALL ()
call ProccessFile
call showinfo ' should run AFTER "ProccessFile" finished
call MakeAll ' should run AFTER "showinfo" finished
end sub

Previous Next As It Pertains To VB6
I have an issue regarding the fun "previous / next" concept.

I have 45 cmd buttons on my form in an object array. (indexed 0 to 44). Suppose I have 135 records. 45 DIV 3 makes it nice and easy.

I connect to my database (mySQL) and return the first 45 recordset no problem. What happens if I need the second set? What happens if I need the 1st set again after I am on the second set of 45 records. Even worse how do I handle if another terminal deletes one of the records in the first set that I am navigating back to. Does anyone have any ideas on how to handle this. I haven't dealt with it before.

Thanks in Advance.

Matt

Add New Record From Previous
Hi,

what I need to do is be able to add a new record to the mdb depending on what is in the previous record.

so for eg:

first record:                          balance=$0
previous record:        add $40        balance=$40
new record:             add $10        balance=$50

this is the code I have attached to an OK button:

    rsRecordSet.Source = "Select * From log_deposit"
    rsRecordSet.ActiveConnection = connConnection
    rsRecordSet.Open
    rsRecordSet.AddNew
    rsRecordSet("Period").Value = txtperiod.Text
    rsRecordSet("Date").Value = txtdate.Text
    rsRecordSet("Balance").Value = rsRecordSet("Balance") + txtamount.Text
    rsRecordSet.Update

So if anyone knows how to do this, pls reply

Thanks.

Previous/Next Question
Can anyone please help me on how to move to the next and previous
question?

Here is a snippet of my code:

Private Sub cmdNext_Click()
End Sub

Private Sub cmdPrevious_Click()
showrecord
End Sub

Private Sub Form_Load()
Dim i As Integer
For i = 0 To 3
Check1(i).BackColor = RGB(255, 255, 255)
Next
temstr = App.Path + " estengine.mdb"
Set db = OpenDatabase(temstr)
initialise
End Sub
Sub initialise()
Dim i As Integer
Dim j As Integer
j = 0
Set rs = db.OpenRecordset("Select QuestionNo From QMultiple Where
Selected = True Order By QuestionNo")
rs.MoveFirst
While rs.EOF = False
j = j + 1
selquestion(j) = rs!questionno
rs.MoveNext
Wend
showrecord (1) 'Show first question
End Sub

Function quizscore() As Integer 'Returnes user's current score
Dim score As Integer
Dim i As Integer
For i = 1 To 20
Set rs = db.OpenRecordset("select solution from qmultiple where
questionno=" & selquestion(i))
If rs!solution = attempted(i - 1) Then
score = score + 1
Next
quizscore = score
End Function
Sub showrecord(n As Integer) 'Displays question with qno=n
Set rs = db.OpenRecordset("select * from qmultiple where questionno="
& selquestion(n))
With frmQuiz
..lblQuestion = rs!question
..Check1(0).Caption = rs!ans1
..Check1(0).Value = Val(Mid(attempted(n - 1), 1, 1))
..Check1(1).Caption = rs!ans2
..Check1(1).Value = Val(Mid(attempted(n - 1), 2, 1))
..Check1(2).Caption = rs!ans3
..Check1(2).Value = Val(Mid(attempted(n - 1), 3, 1))
..Check1(3).Caption = rs!ans4
..Check1(3).Value = Val(Mid(attempted(n - 1), 4, 1))
..lblQNo.Caption = n
End With
End Sub

I want to move to the next question using the cmdNext button and move
to the last question using the cmdPrevious button.

Thanks guys.

Rembering Previous Value
Remembering changes in values


Please refer to the attachment.

This is a sequence of values over a time period. Ignore the figures in the centre columns.
As you can see, the figures either side of the columns vary over time. For example, the change on the previous in the top right figure in red is –5. Values can also increase – first figure in left column has gone from 82 t0 184 (+182).

Is it possible to determine a change in a cell’s value from its previous value (and inserted to the next column – left/right)? Presumably this would entail “remembering” or temporarily retaining - I have seen this directly in Excel but can’t remember the details.

I have include part of the current code (which I didn’t write) below if it helps.

There is a related, but separate, question which I will post in due course.

Any suggestions greatly appreciated.

Grant.


 
Code:
Else
        Buy1 = .FeedFields(FFBuy1): BidSize = .FeedFields(FFBidSize)
        Sale1 = .FeedFields(FFSell1): AskSize = .FeedFields(FFAskSize)
        '---
        ExcelDoc.Sheets(1).Cells(nRow, 3).Value = Buy1
        ExcelDoc.Sheets(1).Cells(nRow, 4).Value = Sale1
        ExcelDoc.Sheets(1).Cells(nRow, 5).Value = BidSize
        ExcelDoc.Sheets(1).Cells(nRow, 6).Value = AskSize
        ExcelDoc.Sheets(1).Cells(nRow, 7).Value = .Close(0, Data)
        ExcelDoc.Sheets(1).Cells(nRow, 8).Value = .Volume(0, Data)
        '---
        ExcelDoc.Sheets(1).Cells(13, 14).Value = BidSize 'Bid volume
        ExcelDoc.Sheets(1).Cells(14, 14).Value = .LimitVol(2, osBuy, 0, Data)
        ExcelDoc.Sheets(1).Cells(15, 14).Value = .LimitVol(3, osBuy, 0, Data)
        ExcelDoc.Sheets(1).Cells(16, 14).Value = .LimitVol(4, osBuy, 0, Data)
        ExcelDoc.Sheets(1).Cells(17, 14).Value = .LimitVol(5, osBuy, 0, Data)
        ExcelDoc.Sheets(1).Cells(18, 14).Value = .LimitVol(6, osBuy, 0, Data)
        ExcelDoc.Sheets(1).Cells(19, 14).Value = .LimitVol(7, osBuy, 0, Data)
        ExcelDoc.Sheets(1).Cells(20, 14).Value = .LimitVol(8, osBuy, 0, Data)
        ExcelDoc.Sheets(1).Cells(21, 14).Value = .LimitVol(9, osBuy, 0, Data)
        ExcelDoc.Sheets(1).Cells(22, 14).Value = .LimitVol(10, osBuy, 0, Data)

Tab To Previous Location...
Good morning everyone,
I'd like to know if anyone can help me with this...
What I want to do is create a global hotkey which instead of taking you to the next link, form, object, etc.(pressing the tab key) It would be something like Alt+Tab or something, which would take you to the previous object, form, link, etc.
I'm guessing the tab key is just a focus + 1 or something...so previous, obviously would be -1 or something...
Whatever the case..I have a way to make a global hotkey already...I just need to figure out how to control it to do this...
Also, semi-unrelated...Is it possible, and if so how - to run a dll created in visual basic 6, at system startup and still do things like be a global hotkey, or whatever?

Thanks in advance

Previous Insert
What SQL do I perform to get the auto generated ID after an insert ?

Thanks

Previous And Next Button
Hi to all,
Could you please guide me how to create previous and next button using vb6 and mysql? Im already exhausted looking for it on the web.
I really appreciate your help

Thank you in advance!

Previous Instance
If there is a previous instance of a vb program running, is there a way to either shut down the previous instance on start up of the vb program or bring the previous instance into focus & shutdown the new instance? Any help would be much appreciated...

Previous Instance
Trying to create multiple instances of a standard exe program that will be accessing the same database.

How should the database be managed?

Because when one instance of the program deletes a record in the database and another instance tries to edit the same record, it will cause problem.

Was thinking of using "app.PrevInstance" property to detect if another instance has been created and lock the database to be a read-only grid.

But how would it be possible to detect that the first instance has released the database?

Is there any other help available?

Thank you.

How To Erase The Previous Drawing ?
hai

i use this code to draw a frame on the screen (Display) in the specified rect region. problem is, when a new region is selected for the drawing, how do i erase the current drawing on the screen ?


Code:
'Creates a handle to the Display / Screen
lhDC = CreateDCAsNull("DISPLAY", ByVal 0&, ByVal 0&, ByVal 0&)

'Create a brush
lBrush = CreateSolidBrush(RGB(0, 255, 0))

'Select the brush in to DC
lOldObj = SelectObject(lhDC, lBrush)

'Creates a region. The rect is passed by GetwindowRect()
lReg = CreateRectRgn(rt.Left, rt.Top, rt.Right, rt.Bottom)

'Draw the Frame over the region
lRetRect = FrameRgn(lhDC, lReg, lBrush, 3, 3)

'Replace old object
Call SelectObject(lhDC, lOldObj)
DeleteDC lhDC

Vb6 'application Install On Previous OS
i have an application that run on my station(os:win 2000).
when i want to install it on a station (win95 or win 98),
after install dcom98 and vbrun.
I install my application and when i want to run it
an error occur :
Error of execution '3265' element not found in the collection

Thank U.

App.path Previous Folder
i use the app.path, but i how i can i find the previous folder?

App.Path writes it like this:
c:examplecode

but i need
c:example

How To Restore Previous Instance Of App?
I can find out if instance of App is running or not with
App.PrevInstance = True
However I want to restore the main Form of this Application's instance when App.PrevInstance return True.
How can I do this?

Recording Previous Text
Hi guys,
If I have 3 types of values to display in a text box, and i wan them to record the previous results, how can i do it without the textbox repeating the answer? for eg.
if check1 = 1 then
text4.text = .......(the formula) & vbNewLine & _
text4.text
if check2 = 1 then
text4.text = .......(the formula) & vbNewLine & _
text4.text
if check3 = 1 then
text4.text = .......(the formula) & vbNewLine & _
text4.text
When i do this, it always record a result more than once. The result will turn out like this. For eg, first time round
Answer1
Next time I calculate again, I only wan it to display the latest answer, yet it displays
Answer2
Answer1
Answer1
can i make it such that everytime i click the commandbutton, it will only display the latest answer and the previous answer. thank you.

Using Next And Previous In Reading A File
Hello,
I am a newbie and I have a problem that I hope someone can help me with. I am writing a small program and one part of it is a post-it note. I have my code written where it will read the file and display the first line of text. What I need help with is I have a next button so when pushed it will read the next line of text and display it. I also have a previous button when pushed it will back up and display the previous line of text. How do I code thse two buttons so they will work properly, and more specifically how do I change the "reading" part of the code to increment when the buttons are pushed? Below is the code I have written so far for the reading of the file.



Dim fs
Dim f
Dim lines
Dim x
'''''''''''''''''''''''''''''''''''''''''''''''''' set up all variables

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(("c:..........................................Notes. txt"), 1, True, -2)


'''''''''''''''''''''''''''''''''''''''''''''''''' count the number of files
lines = 0
Do While f.AtEndOfStream = False
f.readline
lines = lines + 1
lblTotalNotes = lines & " Notes"
Loop
'''''''''''''''''''''''''''''''''''''''''''''''''' return to line 1
f.Close
Set f = fs.OpenTextFile(("c:....................................Notes.txt"), 1, True, -2)
lblNoNotes = f.readline
f.Close


Thanks in Advance, Frustrated!!!!!!!

Copyright 2005-08 www.BigResource.com, All rights reserved