Split off from To search record.
No worries :)
Let us know how this works for you.
It works well..Another question is I want to delete records from a form when I try to delete from the form, the records do not delete in the table. Why do this happen? I use the access button wizards.
The form name is [Delete Record]. The control are
textbox: [txtISBN],
button: cmdDelete,
where user enter the ISBN/ISSN number and click delete, the records will be deleted.
8 7849
I used this code - Dim strMsg As String
-
Dim strSQL As String
-
-
strMsg = "Are you sure you want to delete this record? You cannot undo a deletion."
-
-
If MsgBox(strMsg, vbYesNo) = vbYes Then
-
strSQL = "DELETE * FROM [Printing Media Library] WHERE [Printing Media Library].[ISBN/ISSN]= " & [Forms]![View/Delete Record]![txtISBN] & ";"
-
CurrentDb.Execute strSQL, dbFailOnError
-
DoCmd.GoToRecord , , acNewRec
-
Else
-
DoCmd.OpenForm "Delete Record"
-
End If
and there is error saying "data type mismatch in criteria expression"
and I want to know how to disable the design,view,lay out view,so that user cannot change it....
NeoPa 32,564
Recognized Expert Moderator MVP
and I want to know how to disable the design,view,lay out view,so that user cannot change it....
Are you talking about the Form property Allow Design Changes? This should be set to Design View Only.
NeoPa 32,564
Recognized Expert Moderator MVP
I used this code - Dim strMsg As String
-
Dim strSQL As String
-
-
strMsg = "Are you sure you want to delete this record? You cannot undo a deletion."
-
-
If MsgBox(strMsg, vbYesNo) = vbYes Then
-
strSQL = "DELETE * FROM [Printing Media Library] WHERE [Printing Media Library].[ISBN/ISSN]= " & [Forms]![View/Delete Record]![txtISBN] & ";"
-
CurrentDb.Execute strSQL, dbFailOnError
-
DoCmd.GoToRecord , , acNewRec
-
Else
-
DoCmd.OpenForm "Delete Record"
-
End If
and there is error saying "data type mismatch in criteria expression"
I expect [ISBN/ISSN] is a string/text field. In which case the format of your SQL is wrong. Try this for line #7 instead : - strSQL = "DELETE * " & _
-
"FROM [Printing Media Library] " & _
-
"WHERE [ISBN/ISSN]='" & [Forms]![View/Delete Record]![txtISBN] & "'"
I expect [ISBN/ISSN] is a string/text field. In which case the format of your SQL is wrong. Try this for line #7 instead : - strSQL = "DELETE * " & _
-
"FROM [Printing Media Library] " & _
-
"WHERE [ISBN/ISSN]='" & [Forms]![View/Delete Record]![txtISBN] & "'"
Thank you, it works now...thanks a lot
NeoPa 32,564
Recognized Expert Moderator MVP
Excellent. That's two threads sorted in a week (or so) :D
Sounds like progress ;)
How can I make the report do not show any empty records? For example, in this [Company] table do not has address...I want the report only shows company that has address
NeoPa 32,564
Recognized Expert Moderator MVP
OK. But do me a favour.
Post this question in it's own thread with all the required details (searching through the previous thread to remind myself of everything leaves me dooing all the work here. That's not the right balance).
Feel free to post a link in here to your new thread and I will certainly have a look and help. This should be a simple question, but without the facts to hand, it is far more complicated than it needs to be.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Steve |
last post by:
I have several pairs of synchronized subforms in an application. I have a Delete
button for each pair that uses the following code or similar to delete a record
in the second subform:
DoCmd.SetWarnings False
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
End If
ExitHere:
Me!SubName.SetFocus
|
by: hpi |
last post by:
Hello,
I have a table : Batch
It contains fields
batchnummer : Number (Long Integer)
datum : Date/Time
status : Number (Long Integer)
nr_records : Number (Long Integer)
|
by: Paul T. Rong |
last post by:
Dear all,
Here is my problem:
There is a table "products" in my access database, since some of the
products are out of date and stopped manufacture, I would like to delete
those PRODUCTS from the table, but I was not allowed to do that, because
"there are records related with those PRODUCTS in other tables (e.g. in
table "ORDER_DETAIL").
|
by: Tim Marshall |
last post by:
HI all, Access 2003, Jet back end.
Rather than annoy my users in a particular app by having relationships
with enforced relational integrity refuse to delete a record with
related records, I'm using cascade delete. When I use a continuous form
and a record is deleted, Access provides a warning that there are
related records, do you want...
|
by: Darin |
last post by:
I have a table that I want to delete specific records from based on
data in other tables. I'm more familiar with Access '97, but am now
using 2003, but the database is in 2000 format. In '97, I think I
could have easily done this using joins, but I kept getting "could not
delete from specified tables" errors. Some google searching has...
| |
by: paulwilliamsonremove |
last post by:
Hi,
Using Access 2003.
I am trying to delete records from one table/query
("qryHistoryPersonIDs") if they don't exist in another table
("qryDonations"). But the SQL syntax I came up with is taking forever
or locking up Access 2003.
What am I doing wrong?
|
by: polocar |
last post by:
Hi,
I'm writing a program in Visual C# 2005 Professional Edition.
This program connects to a SQL Server 2005 database called
"Generations" (in which there is only one table, called
"Generations"), and it allows the user to add, edit and delete the
various records of the table.
"Generations" table has the following fields:
"IDPerson",...
|
by: Kevin M |
last post by:
I have one table and have created a form from that table. Also, I have
created a delete query. I want to but a button on the form which will delete
all records from the table; however, I cannot get anything to work. I know
this is probably simple for more experienced Access users. Any help would be
greatly appreciated.
Thanks
Kevin
|
by: Bob Bridges |
last post by:
Start with two tables, parent records in one and child records in the other,
a one-to-many relationship. Create a select statement joining the two.
Display the query in datasheet mode. When I delete a row, only the child
record is deleted from the source tables; the parent record is still
there...which is what I wanted.
Now display fields...
|
by: Phil Stanton |
last post by:
I have a form based on a complex query (Lots of tables)
If I delete a record, everything appears to be OK. Get the message "Youa are
about to delete 1 record ....". I say yes. The record count goes down
correctly. Then if I do Records-->Remove Filter/Sort there are the deleted
records back as if they had never been deleted. Same thin exactly...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |