Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deleting from a recordset

Status
Not open for further replies.

autoIT

IS-IT--Management
May 10, 2006
68
US
if ***.delete will delete one record at a time, what deletes all records from a table with a single click of a button. I tried writing a do until eof loop but I get a multistep OLE Db error. Any suggestions?

Adam
 
deletes all records from a table
CurrentDb.Execute "DELETE FROM yourTable"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
How about this?
Code:
CurrentProject.Connection.Execute "DELETE * FROM WhateverTable"
 
CurrentDb.Execute "delete from empquery"

so would this be the correct coding if table is named empquery?
 
that woked well thank u. I have another realtively simple question:

if you're checking what values variables hold,for exmaple:

for strings you check if var1=""
for integers we check if var1=0

how do we check for empty DATE values?

I have a situation where I'm checking 2 textboxes to see if they are both empty. I first check a TB that would contain a name and if it's empty I have a nested if to check the other textbox where a date may be place. If the first one has an empty value and the second(date) has an empty value , then there is an input box asking for a date to be entered. However this inputbox has an ok and a cancel button and if either are clicked with nothing entered then I get a type mismatch error. I tried writing a do until (var)<> 0, and continued to get the same result. This is where the question comes in about empty date values. I will include the code so you can see what I'm talking about and assume all variables are dimmed.

thanks adam



txtEmpQry.SetFocus
If txtEmpQry.Text = "" Then
txtPPQry.SetFocus
If txtPPQry.Text = "" Then
answer = MsgBox("Would you like to search by Employee?", vbYesNo)
If answer = 6 Then
input1 = InputBox("Please enter Employees name")
txtEmpQry.SetFocus
txtEmpQry.Text = input1
ElseIf answer = 7 Then
Do While input2 = 0
input2 = InputBox("Please enter Pay Period formatted with short date format xx/xx/xxxx")
Loop
'txtPPQry.SetFocus
'txtPPQry.Text = input2
End If
End If
End If




 
for strings you check if var1=""
for integers we check if var1=0

how do we check for empty DATE values?


Dates are numbers.... do it the same way as you would for integers... if var1 = 0 then


Randy
 
so do i need to dim the variable as an integer, or can i still dim it as date but check if it =0 or not.
 

Since you want it to hold a date, I would Dim it as a Date. You can still check to see if it equals 0.


Randy
 
A starting point:
Do Until IsDate(input2)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top