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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with SQL code 1

Status
Not open for further replies.

psarros

MIS
Feb 17, 2002
67
US
I have a database to keep track of tape backups.
I have programed an Archive function, which will delete a tape ID from the [Tape Iventory and Labels] tabel and move it to the Archived table.

Just to make the function a little cleaner, I want to let the user know how many records are being archived.

I have a form called [Frmcleanup] which has an input field called [delItem]

The user types in the tape number he wasnts to archive and clicks the archive button...

for some reason Access 97 does not like the following sql code:

strSQL = "SELECT [Tape Inventory and Labels].ID " & _
"FROM [Tape Inventory and Labels] " & _
"WHERE ([Tape Inventory and Labels].[Bar code tape ID]=[forms]![Frmcleanup].[delItem])"

It does not like the [forms]![Frmcleanup].[delItem]

when I use the command:
Set rst = db.OpenRecordset(strSQL)

I get the error " Too few parameters. Expected 1

any ideas?
thanks
 
Hi!

Try this:

strSQL = "SELECT [Tape Inventory and Labels].ID " & _
"FROM [Tape Inventory and Labels] " & _
"WHERE ([Tape Inventory and Labels].[Bar code tape ID]= '" & [forms]![Frmcleanup].[delItem] & "')"

The code above assumes that the ID field is text. If it is numeric then leave out the single quotes.

hth
Jeff Bridgham
bridgham@purdue.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top