Strange behaviour with default values on bound form

303factory

Registered User.
Local time
Today, 13:12
Joined
Oct 10, 2008
Messages
136
Hi all

I've recently been trying to upgrade my software so instead of access queries I have sql server views. The continuous subforms will be bound to an editable recordset instead of a sql statement using an access query

I've got this up and running but I'm getting some strange behaviour of default values. When I add a new record the checkboxes should always default to 'False' but they seem to be random, sometimes being true sometimes being false. If you try to change it manually back to false it will be stuck and you may have to press it say 10 times before it finally changes. There are about 5 checkboxes on the form and having these randomly filling out is obviously terrible. Here's my code

Connection
Code:
Set gFormConn = New ADODB.Connection
    With gFormConn
        .Provider = "MSDataShape" 
        .ConnectionString = "DATA PROVIDER=SQLOLEDB;Server=" & getServerName & ";Database=***;Uid=***; Pwd=***"
        .CursorLocation = adUseServer
        .Open
   End With

Create recordset and bind to form
Code:
strView = "viewMEContacts" ' view stored on SQL server 2008 database

Set gFormRS = New ADODB.Recordset
    With gFormRS
        Set .ActiveConnection = gFormConn
        .Source = "SELECT * FROM " & strView & " WHERE UniqueRef = " & gUniqueRef & " AND Hex = " & Chr(39) & strHex & Chr(39) & " AND DataSet =" & intDataSet
        .LOCKTYPE = adLockOptimistic
        .CursorType = adOpenKeyset
        .Open
    End With
Set Me.DisplayPanel.Form.Recordset = gFormRS

Any ideas why I'm getting such crazy behaviour? Is my method of creating
an editable recordset from a view and binding it to the form not a good idea? I heard it was doable..

Thanks in advance

303
 

Users who are viewing this thread

Back
Top Bottom