Solved

How check whether a form is bound to a recordset?

Posted on 2006-07-17
6
274 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
  • 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now