Reply
MS Access 2003 - help - error when searching for record from command button
Old 07-10-2009, 12:39 AM MS Access 2003 - help - error when searching for record from command button
Junior Talker

Posts: 1
Trades: 0
Hi Everyone,
I'm very new at coding, so I am hoping someone can help.
I want to create a command button that people can click on that will ask for an ID number which is also the primary key of the access database - I have picked up this script from microsoft, but now receive an error when I hit ok in the pop up window (error is Empty row cannot be inserted. Row must have at least one column value set.)
Script is as follows- can anyone please help me with this? (and explain it simply???) thanks


<SCRIPT language=vbscript event=onclick for=Command1>
<!--
' Clone the recordset.
Dim rs
Set rs = MSODSC.DataPages(0).Recordset.Clone
Onerrorresumenext
' This line assumes that the value you are filtering on is an integer.
' If the search value is a string, use slightly different syntax.
' For example, "PMOProjectID = '" & CStr(InputBox("Please enter PMO ProjectID to find", "Find")) & "'"
' rs.find "PMOProjectID=" & cLng(inputbox("Enter a PMO ProjectID","Find"))
rs.find "PMOProjectID = '" & CStr(InputBox("Please enter project ID to find", "Find")) & "'"
' Custom error handling.
If (err.number <> 0) Then
Msgbox "Error: " & err.number & " " & err.description,,"Invalid Search"
ExitSub
EndIf
' Check search results for success.
If (rs.bof) or (rs.eof) Then
Msgbox "No Project found",,"Search Done"
ExitSub
EndIf
MSODSC.DataPages(0).Recordset.Bookmark = rs.Bookmark
-->
</SCRIPT>
Snaptaff is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Reply     « Reply to MS Access 2003 - help - error when searching for record from command button
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.11335 seconds with 13 queries