473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Pause for user input

Can anyone help me...my msgbox seems to be disallowing my users from selecting a new symbol from my combo box called comboSelectSymbol. I ultimately want my users to be able to select any number of stock symbols from my combobox comboSelectSymbol and have these symbols added to a table called TempSymbol. There are over 4000 symbols to select from. Thank you for any help!

Private Sub comboSelectSymbol_AfterUpdate()
Dim MsgAnswer As String
Dim strSQL As String
MsgAnswer = 6
DoCmd.SetWarnings (False)
DoCmd.RunSQL "DELETE * FROM TempSymbol"
Do While MsgAnswer = 6
strSQL = "INSERT INTO TempSymbol (Symbol)"
strSQL = strSQL & " VALUES ('" & comboSelectSymbol & "');"
DoCmd.RunSQL strSQL
MsgAnswer = MsgBox("Do you want select another symbol? ", vbYesNo)
If MsgAnswer = 6 Then
Me!comboSelectSymbol.SetFocus
Me!comboSelectSymbol.Dropdown
End If

Loop
DoCmd.SetWarnings (True)
End Sub
Sep 28 '06 #1
6 4061
Tanis
143 100+
Is the symbol already in the table, or are you trying to add a new one?
Sep 29 '06 #2
Is the symbol already in the table, or are you trying to add a new one?
All symbols are being pulled from a table called DailyPrice. The objective here is to allow the user to select any number of symbols from combo box...output to a temp table called TempSymbol...and then the program will use this list to perform other tasks.
Sep 29 '06 #3
Tanis
143 100+
I have slightly modified your code. I have changed it so that the criteria refers to the combobox on the form. It looks like the loop is causing the problem. Take it out of the loop and it functions as it should. One question though,why are duplicating data?
Expand|Select|Wrap|Line Numbers
  1. Private Sub ComboSelectSymbol_AfterUpdate()
  2.  
  3. Dim MsgAnswer As String
  4. Dim strSQL As String
  5. 'MsgAnswer = 6
  6. DoCmd.SetWarnings (False)
  7. DoCmd.RunSQL "DELETE * FROM TempSymbol"
  8. 'Do While MsgAnswer = 6
  9.  
  10. strSQL = "INSERT INTO TempSymbol ( TempSymbol ) "
  11. strSQL = strSQL & "SELECT DailyPrice.Symbol "
  12. strSQL = strSQL & "From DailyPrice "
  13. strSQL = strSQL & "WHERE (((DailyPrice.Symbol)=[forms]![DailyPrice]![comboselectsymbol]));"
  14.  
  15. DoCmd.RunSQL strSQL
  16.  
  17. MsgAnswer = MsgBox("Do you want select another symbol? ", vbYesNo)
  18. If MsgAnswer = 6 Then
  19. Me!ComboSelectSymbol.SetFocus
  20. Me!ComboSelectSymbol.DropDown
  21. End If
  22.  
  23. 'Loop
  24.  
  25. End Sub
  26.  
Sep 29 '06 #4
I have slightly modified your code. I have changed it so that the criteria refers to the combobox on the form. It looks like the loop is causing the problem. Take it out of the loop and it functions as it should. One question though,why are duplicating data?
Expand|Select|Wrap|Line Numbers
  1. Private Sub ComboSelectSymbol_AfterUpdate()
  2.  
  3. Dim MsgAnswer As String
  4. Dim strSQL As String
  5. 'MsgAnswer = 6
  6. DoCmd.SetWarnings (False)
  7. DoCmd.RunSQL "DELETE * FROM TempSymbol"
  8. 'Do While MsgAnswer = 6
  9.  
  10. strSQL = "INSERT INTO TempSymbol ( TempSymbol ) "
  11. strSQL = strSQL & "SELECT DailyPrice.Symbol "
  12. strSQL = strSQL & "From DailyPrice "
  13. strSQL = strSQL & "WHERE (((DailyPrice.Symbol)=[forms]![DailyPrice]![comboselectsymbol]));"
  14.  
  15. DoCmd.RunSQL strSQL
  16.  
  17. MsgAnswer = MsgBox("Do you want select another symbol? ", vbYesNo)
  18. If MsgAnswer = 6 Then
  19. Me!ComboSelectSymbol.SetFocus
  20. Me!ComboSelectSymbol.DropDown
  21. End If
  22.  
  23. 'Loop
  24.  
  25. End Sub
  26.  
I don't want to duplicate data. I want the use to be able to choose any number of symbols and store these selections into a temporary table. Should I be using multi-select instead? If so, do you know the code for this? thank you so much for help!!!
Sep 29 '06 #5
PEB
1,418 Expert 1GB
Hi,

I agree with Tanis that the loop is doing the problem...

Instaed using loop why don't you put an After update event on your combo box and so when the value is updated this After Update will run an other time the function... And so your cycle will function...?


Best regards

:)
Sep 30 '06 #6
PEB
1,418 Expert 1GB
Opa,

I've seen that your code is in after update event

So what is the need of your cycle?

U can make appear your msgbox without using a cycle, can't U?

With the same result I think?

if msgbox() =vbyes then
yourcontrol.setfocus
yourcontrol.dropdown
end if


:)
Sep 30 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

31
by: da Vinci | last post by:
OK, this has got to be a simple one and yet I cannot find the answer in my textbook. How can I get a simple pause after an output line, that simply waits for any key to be pressed to move on? ...
1
by: ericm | last post by:
Hello all, I am looking for a little guidence. I have written a page in which I am trying to identify when a function key (f1-f12) is pressed. When the key is pressed a pre-defined event will...
5
by: Brian.Steele | last post by:
Greetings everyone. See http://www.spiceisle.com/cgi-bin/slideshow/slideshow.cgi?dir=brian/personal/2005/uk_trip/images&type=jpg The "Pause" button works in IE, but not in Firefox. Any ideas...
10
by: Amit Nath | last post by:
Hi! I am running a C program and need to pause the program and change some of the variables. Is there any function that checks if there is a character in the Standard Input Buffer, else the...
8
by: Wim | last post by:
My GUI application starts a process (a console program) when the user hits Play. I would like to add an option to pause that process. The code I've added to detect if the user hit pause/unpause...
38
by: Jackie | last post by:
I just want the programme to stop for a while. Thanks.
2
by: eSolTec, Inc. 501(c)(3) | last post by:
Thank you in advance for any and all assistance. Is there a way to start, pause and resume a recurrsive search exactly where you left off, say in the registry programmatically? -- Michael Bragg,...
8
by: Lloydm | last post by:
I've used the command "pause" in batch files which works ok but I guess it's applied dirrently in c++. Using Dev C++ 4.0 and the following is my code #include<iostream> #include<iomanip>...
11
nathj
by: nathj | last post by:
Hi, I have a strange problem, my code is running too quickly. Allow me to explain (if I can). I am using the XMLHTTP object in order to query the database as a user completes the membership...
3
by: nma | last post by:
Hi This code goes well with play, stop and fullscreen button, the only thing is the pause button is not there. How to make pause button? I try to make pause button but when it streams video, when...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.