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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
Check for record loaded on form
Wayne,
Thank you, the current event worked beautifully. |
Thread Tools | |
Display Modes | |
|
|
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 |