473,394 Members | 1,797 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.

How to run mysql within a subroutine from the Windows C: prompt

imrosie
222 100+
Hello,

I'm trying to work the bugs out of my app. At compile time I get an error (grey bar covering the 'mysql')when I put the following code in:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdErasePic_Click()
  2. If Not IsNull([imageFile]) Then
  3.     If MsgBox("This image will be permanantly removed, Are you sure?", vbYesNo + vbQuestion) = vbYes Then
  4.     Me!frmimagesubform.Form![imgPicture].Picture = ""
  5.     Me![imageFile] = Null
  6.     SysCmd acSysCmdClearStatus
  7.     DoCmd.SetWarnings False
  8. Dim strSQL As String
  9. 'DELETES the Current Record
  10. mysql = "DELETE * FROM imageInventory Where imageInventory.[imageID] = " & Me![imageID]
  11. DoCmd.strSQL mysql
  12. 'Move the Record Pointer IN some manner
  13. DoCmd.SetWarnings True
  14.     Call Form_Current
  15.     End If
  16.   End If
  17. End Sub
thanks in advance
May 21 '07 #1
5 1362
nico5038
3,080 Expert 2GB
I've moved your question to the Access forum, so all experts can have a look.

I'm a bit puzzled why you use "mysql", while you define;
dim strSQL

Both won't be needed when you use:

currentdb.execute ("delete * from X where ID=" & myID)

Nic;o)
May 21 '07 #2
imrosie
222 100+
I've moved your question to the Access forum, so all experts can have a look.

I'm a bit puzzled why you use "mysql", while you define;
dim strSQL

Both won't be needed when you use:

currentdb.execute ("delete * from X where ID=" & myID)

Nic;o)
Someone gave this me and I followed it. I'm a newbie. Sorry, what should it be? thanks
May 21 '07 #3
NeoPa
32,556 Expert Mod 16PB
Someone gave this me and I followed it. I'm a newbie. Sorry, what should it be? thanks
Rosie, try to bit a bit more specific showing which error message you got and on which line of the code (by number).
May 23 '07 #4
imrosie
222 100+
Rosie, try to bit a bit more specific showing which error message you got and on which line of the code (by number).

Thanks for your response NeoPa....I finally got it working with help from thescripts, of course. Here's the code that works but has one more issue stated beneath:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdErasePic_Click()
  2. If Not IsNull([imageFile]) Then
  3.     If MsgBox("This image will be permanantly removed, Are you sure?", vbYesNo + vbQuestion) = vbYes Then
  4.     Me!frmimagesubform.Form![imgPicture].Picture = ""
  5.     Me![imageFile] = Null
  6.     SysCmd acSysCmdClearStatus
  7.     DoCmd.SetWarnings False
  8.     Dim mysql As String  'Declare the Variable by assigning SQL String to the variable mysql
  9.  mysql = "DELETE * FROM imageInventory Where imageInventory.imageID = " & Me![imageID]
  10.  'Execute the SQL Statement is next
  11. DoCmd.RunSQL mysql
  12. DoCmd.SetWarnings True
  13.     Call Form_Current
  14.     End If
  15.   End If
  16. End Sub
The other issue is that once the delete occurs, immediately the message #Deleted, pops up in each of the form controls. It causes a problem when (on same form) a user clicks the 'next' control or 'previous'...They get a msg saying 'Type mismatch' error. This error goes away after you close form and reopen (which apparently gets rid of the table deletes, so no error). I've tried using Me.Refresh immediately after the delete in the code, but it doesn't clear it out immediately, I still have to close form and re-open. Any ideas?
May 23 '07 #5
NeoPa
32,556 Expert Mod 16PB
.Refresh won't do it for you. You need .Requery.
The former merely updates the data in records that already were included in your recordset.
May 23 '07 #6

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

Similar topics

0
by: Ola Ogunneye | last post by:
--=_7B255FAE.1F7E0C30 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hello all, Let me start out by saying that I am still a newbie. I just freshly installed...
0
by: Jeff D. Hamann | last post by:
I've asked this question on the emacs newsgroup and didn;t get an answer, so I thought I might post the question here. I've been using emacs sql-mode for some time now (with MySQL) and love it....
4
by: Jeff S | last post by:
To make a long story short, let me say I had MySQL working on Windows 98 and everything was fine. Well, I took the big leap and removed all traces of Windows and Microsoft from the computer....
1
by: el chupacabra | last post by:
I'm using mysqldb module and python 2.4. I'm a newbie. Thanks in advance. 1. Output desired: "hello" "world" I know that MySQL takes \n and \t and what not. But my python script, it...
175
by: Sai Hertz And Control Systems | last post by:
Dear all, Their was a huge rore about MySQL recently for something in java functions now theirs one more http://www.mysql.com/doc/en/News-5.0.x.html Does this concern anyone. What I...
3
by: apostolosl | last post by:
Hi there. I need to update a remote database from a local one. I use mysqldump in my php page in order to create a file for each table, like this: $command="mysqldump table_products >...
0
by: Gabriel Genellina | last post by:
En Sun, 21 Sep 2008 19:42:10 -0300, Blubaugh, David A. <dblubaugh@belcan.comescribió: Below there is a transcript of a compile session. I've used a somewhat old version of mingw and g77, scipy...
2
by: jim190 | last post by:
I am relatively new to using VBA and am have been trying for two days to pass a user entered value to my report for filtering when opened. I have the following subroutine in the open event of my...
1
by: sganeshsvk | last post by:
i want to clear the screen command prompt for mysql in windows XP... In linux we use (CTRL + L) for clear the screen in mysql prompt.... i already use this command ( \c ) then ( \! clear ) for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.