A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Check for record loaded on form



 
 
Thread Tools Display Modes
  #1  
Old December 7th, 2005, 07:02 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Check for record loaded on form

Hello,

What is the command to check if a record is loaded within a form in
VBA?

Looking to check when the form changes, so that I can enable or disable
pieces of the form that shouldn't be used when there is no record
loaded.

Also, if anyone could point me to a handy online resource that is able
to cover simple questions such as these so I don't have to ask them,
that'd be great too, save us all time

Thanks,

Lance

  #2  
Old December 7th, 2005, 07:27 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Check for record loaded on form

The form's Current event fires whenever you go from one record to another,
even as you go to the first record when the form opens. If there are
records, then one will be loaded. To see if there are any records, you could
check the form's recordset's RecordCount property. Also, you may want to
make sure that you're not at a new record. The record count will get
adjusted if you filter the form. The Current event will also fire when the
form is filtered or unfiltered.

Example:
If Me.Recordset.RecordCount 0 And Me.NewRecord = False Then
'Place your desired action here
End If

Instead of getting a record count, you could also use the If statement to
check the value of certain fields then make adjustments if that is what you
want.

There are several web sites that have information on Access. One you may
want to start with is http://www.mvps.org/access.

--
Wayne Morgan
MS Access MVP


"Lance" wrote in message
oups.com...
Hello,

What is the command to check if a record is loaded within a form in
VBA?

Looking to check when the form changes, so that I can enable or disable
pieces of the form that shouldn't be used when there is no record
loaded.

Also, if anyone could point me to a handy online resource that is able
to cover simple questions such as these so I don't have to ask them,
that'd be great too, save us all time

Thanks,

Lance



  #3  
Old December 7th, 2005, 09:30 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Check for record loaded on form

Wayne,

Thank you, the current event worked beautifully.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I check if a hidden form is open/loaded? Wiggy Using Forms 3 August 9th, 2005 01:45 PM
Design help, please SillySally Using Forms 27 March 6th, 2005 04:11 AM
Multiple check boxes causing form to appear blank StuC Using Forms 2 February 11th, 2005 09:07 AM
Need to clear controls of Filter form Jan Il Using Forms 2 November 28th, 2004 02:04 PM
dlookup miaplacidus Using Forms 9 August 5th, 2004 09:16 PM


All times are GMT +1. The time now is 08:57 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.