ADO Error - missing required parameter

donq
10-23-2004, 12:21 PM
Greetings to the forum:

I'm using Access 2000, and VB6, trying to retrieve a record that's in a text box (txt_cust_no), which I can see populated with a valid entry, and I'm running into the following error message:

Run-time error '2147217904 (80040e10)'
no value given for one or more required parameters.

as follows is the code and (=>*) the point of the error:

Sub Make_DB_Connection()
Dim adoConn As ADODB.Connection
Set adoConn = New ADODB.Connection

adoConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
" Data Source=\\megaone\mailorder.mdb;Persist Security Info=False "

Dim adoCustRs As ADODB.Recordset
Set adoCustRs = New ADODB.Recordset
adoCustRs.CursorLocation = adUseClient
Dim RsSelect As String
RsSelect = "SELECT CustID, LastName, FirstName from Customers where CustID = txt_cust_no and CustStatus = 'A' "

=>* adoCustRs.Open RsSelect, adoConn, adOpenStatic, adLockReadOnly, adCmdText

Can someone shed some light on what I'm doing wrong???

Thanks in advance for your input[/QUOTE]

Shurik12
10-23-2004, 12:43 PM
Hi,


RsSelect = "SELECT CustID, LastName, FirstName from Customers where CustID= " & txt_cust_no & " and CustStatus = 'A'"


Shurik.

p.s. I presume CustID is Numeric

donq
10-23-2004, 01:46 PM
Thanks Shurik12

That was on the mony. It solved the problem.

Is it possible that you can answer the following or point me to a link that will help me with the following:

1. If a record is locked to display a message box stating that the record is locked by user xyz (In other words, how can I test for a specific codes, in this case locked or for example if record a record. I'm from a environment that gave me the ability to test for specific codes (record_on_file, no_record_pointer, lock_file, lock_record, etc)

2. to display a recordset in datagrid and be able to select a record for editing from there?

And again thanks for the reply!!!

MKoslof
10-24-2004, 08:24 AM
Regarding question 1:

How are you determining if the record is locked? That is step one. Then, for Access, the best way would probably be to trap the error and give the user a custom error message. For a good review of record locking in Access, look here:

http://www.xtremevbtalk.com/showthread.php?t=194388

Regarding question 2:

Look into using the DataGrid, or one of the Microsoft FlexGrid controls.

donq
10-27-2004, 11:32 PM
Thanks for the pointer and info MKoslof. will look into it.

Donq

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum