|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
I have created a simple Access Database and am working on 2 different data access pages. I have 2 problems on the VBScript.
1. I am trying to program a FIND button. The idea is simply that the user enters a text string into a textbox named txtSearch and upon clicking the command button named Command0, the record containing the string is found. I found a how-to on this on Microsoft's website. But when I use the script in Northwind, it works. When I use it in my database (after changing references), I get a "Microsoft Cursor Engine" error while debugging. Here is the script: <SCRIPT language=vbscript event=onclick for=Command0> <!-- dim i dim fld dim FieldCount FieldCount =MSODSC.DefaultRecordset.RecordCount for i = 0 to FieldCount - 1 set fld = MSODSC.Recordset.fields(i) MSODSC.DefaultRecordset.Find fld.name & " = '" txtSearch.value & "'", 0, 1, 1 if MSODSC.DefaultRecordset.EOF then MSODSC.DefaultRecordset.MoveFirst else exit for end if next set fld = nothing --> </SCRIPT> What is wrong? 2. In another data access page, I'd like it to open to a new record. I added an "Add Record" button, that Access automatically programmed for me. It used JScript's try...catch statement. I took that script, changed references, and tried to use it under MSODSC's Current Event. It works only after giving me a blank Warning message that I click ok through. Why does it give me the error for the current event, but not for the OnClick event of the command button? Here's the code: <SCRIPT LANGUAGE=javascript FOR=MSODSC EVENT=Current> <!-- try { MSODSC.CurrentSection.DataPage.NewRecord(); } catch (e) { alert (e.description); --> </SCRIPT> I would appreciate any help!!! I have been researching these problems and have not been able to find the answers. I am stuck. THANK YOU!!!! Last edited by annt : March 21st, 2003 at 08:47 AM. |
![]() |
| Viewing: Dev Shed Forums > Databases > Database Management > Access 2000 and VBScript Help Please |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|