Solved

How check whether a form is bound to a recordset?

Posted on 2006-07-17
6
311 Views
Last Modified: 2012-05-05
I have a form that I open, then bind a recordset to.

The form's On Current event fires when the form is first opened, before the recordset is bound, and trips an error, since the controls it examines are not yet populated.

How can I write a check to see whether there is a recordset present, to filter out these commands from On Current?

[NB it's possible that the error is due to something else, since only one of several lines in On Current triggers the error:
Me.SectionFinder.Value = Me.Controls("Type").Value
gives error 438: object doesn't support this property or method.]

Happy with an answer to either!

jc
0
Comment
Question by:johnclarke123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 4

Author Comment

by:johnclarke123
ID: 17122693
Sorry - make that runtime error 2424 'The expression has a field, control or property name that Microsoft Access can't find'
0
 
LVL 77

Expert Comment

by:peter57r
ID: 17122708
Hi johnclarke123,

I don't believe you can avoid the errors using this approach.  The fields will show #Error until a valid recordsource is provided.
Why can't you set the form to a valid source and then change it to what you want.
Pete
0
 
LVL 65

Accepted Solution

by:
rockiroads earned 250 total points
ID: 17122770
Why cant u check if a recordsource is present?

If Me.RecordSource <> "" then Me.SectionFinder.Value = Me.Controls("Type").Value

Is that what u mean?

or the other way is to handle errors

on error resume next

err.clear
Me.SectionFinder.Value = Me.Controls("Type").Value

if err.number >0 and err.number <> 436 then  msgbox err.description


0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 65

Expert Comment

by:rockiroads
ID: 17122773
urm, try 438 instead of 436

0
 
LVL 4

Author Comment

by:johnclarke123
ID: 17122793
That would do it.
Thanks a lot.
jc
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17122799
Its tweaks galore day today :)

Thats exactly what Ive had to do with cross site scripting Im doing right now. Not exactly a generic solution but it works
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question