Object Doesn't Support this property or Method

S

Synergy

I want my form to open up to a blank record, so I assigned the RecordSource
property to a record in a dummy table with no data. My intention is to have
the Recordsource become assigned when the user selects a record from a
Combobox. I reassign the Recordsource then the code uses the DAO find
method to bring the selected record up. I am getting a problem however
Dimming the Recordsource to the recordsetclone. Here is the Code snippet in
the AfterUpdate event of the ComboBox:

If Me.RecordSource = "" Or IsNull(Me.RecordSource) Or Me.RecordSource =
"Order Entry Header Blank" Then
Me.RecordSource = "SELECT [Order Entry Header].*, Customers.Custcode,
DateDiff('d',[ordDate],Date()) AS Days FROM [Order Entry Header] LEFT
JOIN Customers ON [Order Entry Header].ordCustID = Customers.Custid WHERE
(((DateDiff('d',[ordDate],Date()))<=" & [DaySet] & ")) ORDER BY
[Order Entry Header].ordJob;"
[TabCtl23].Enabled = True
End If


'Remove Filter/Sort if it is on
If Me.FilterOn = True Then
Me.FilterOn = False
End If


Dim rs As Recordset

The Code then Bombs on the Dim rs line above The error is "Object Doesn't
support this property or method"

Any ideas on how to get around this? I tried requerying the recordsetclone
before dimming the recordset.

God Bless,

Mark A. Sam
 
G

Gary Miller

Access 2000 or above? If so, the error is being thrown
because you need to declare the recordset as a DAO object as
ADO is the default.

Dim rs as DAO.Recordset

But there is a much simpler way to do what you want. Bind
your form to the recordset and set your Form to be DataEntry
and you will get a blank record when it opens. If you have
the form set to AllowEditions, Edits and Deletions, your
combobox in your Header should still have access to all of
the records and you should be able to have the users
navigate to the ones they want. The combobox wizard has a
feature to build the code to select records from the forms
recordset for you from the RecordsetClone.

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
M

Mark A. Sam

Hello Gary,

Thanks for the reply, but your solution won't work. The functioning of the
form needs to pretty much stay intact. I was probably not very clear in
what the issue is.

The form is highly controlled through programming, including new record
entry, meaning the new record is created using the DAO Addnew method.
Previously when the form opened, it was taken to the last record in the
table, which could also be the current record being entered. I thought this
may have been causing problems becuase each new user goes to a record that
may be in the process of entry, so I took the user to the first record. My
client asked me if I could bring them to a blank record then they could
select from the combobox, so that is my task.

This should be an easy. The unbound combo exists now for going to new
records in the AfterUpdate event. The problem is that Access doens't like
assigning the RecordSource in the AfterUpdate of the combobox then allowing
assignment of a recordset variable to the RecordsetClone. That is what I
need to do.

God Bless,

Mark A. Sam



Gary Miller said:
Access 2000 or above? If so, the error is being thrown
because you need to declare the recordset as a DAO object as
ADO is the default.

Dim rs as DAO.Recordset

But there is a much simpler way to do what you want. Bind
your form to the recordset and set your Form to be DataEntry
and you will get a blank record when it opens. If you have
the form set to AllowEditions, Edits and Deletions, your
combobox in your Header should still have access to all of
the records and you should be able to have the users
navigate to the ones they want. The combobox wizard has a
feature to build the code to select records from the forms
recordset for you from the RecordsetClone.

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
Synergy said:
I want my form to open up to a blank record, so I assigned the RecordSource
property to a record in a dummy table with no data. My intention is to have
the Recordsource become assigned when the user selects a record from a
Combobox. I reassign the Recordsource then the code uses the DAO find
method to bring the selected record up. I am getting a problem however
Dimming the Recordsource to the recordsetclone. Here is the Code snippet in
the AfterUpdate event of the ComboBox:

If Me.RecordSource = "" Or IsNull(Me.RecordSource) Or Me.RecordSource =
"Order Entry Header Blank" Then
Me.RecordSource = "SELECT [Order Entry Header].*, Customers.Custcode,
DateDiff('d',[ordDate],Date()) AS Days FROM [Order Entry Header] LEFT
JOIN Customers ON [Order Entry Header].ordCustID = Customers.Custid WHERE
(((DateDiff('d',[ordDate],Date()))<=" & [DaySet] & ")) ORDER BY
[Order Entry Header].ordJob;"
[TabCtl23].Enabled = True
End If


'Remove Filter/Sort if it is on
If Me.FilterOn = True Then
Me.FilterOn = False
End If


Dim rs As Recordset

The Code then Bombs on the Dim rs line above The error is "Object Doesn't
support this property or method"

Any ideas on how to get around this? I tried requerying the recordsetclone
before dimming the recordset.

God Bless,

Mark A. Sam
 
M

Mark A. Sam

I changed my methodology and no longer need this issue addressed.

God Bless,

Mark A. Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top