Full Version: Issues With A Form (and Help With Codes)
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
hawk7890
Good day,

I am getting an error message with one of my forms when I open it from Design view, and I cannot figure out why. All I was able to figure out is it only happens when I have the following code: (form is frmLoanEdit)
Private Sub Form_Load()
End Sub

If someone is available to help me with a few pieces of code I seem unable to figure out. (frmLoanEdit)
the idea is simple enough, when you use frmLoanSearch and search an asset (say C3333), frmLoanEdit opens on that loan record. Can you assist with the following?

-Display the asset number and asset details
-OtherEquipmentLoanSubform: not sure how to build this, the idea is all the items are listed, and when a client borrows a piece of equipment, you put a check for yes or no.
-When ExtendedReturnDate field is changed it automatically enables Extended. Also calculates to ensure the difference between initial loandate and entered date is no more than 20 days
-When callback done button is pressed it adds todays date and the name of the currentuser

Thanks
Marc
missinglinq
Your app has apparently become Corrupted. Fortunately, I was able to get rid of the error using the easiest method for recovering a Corrupted database:
  1. Create a new, blank database file
  2. Go to File - Get External Data - Import
  3. Select the original db file
  4. Go thru all types of of Objects, clicking on Select All
  5. When done hit OK
  6. Save the New Database File with a temporary name
  7. Rename and retain your original file (as a safety measure)
  8. Rename your new file using the name of the original db
You should now be set.

Linq ;0)>
hk1
I agree that it looks like your database has somehow become corrupted and missinglinq's suggestion is probably your only option.

I did note a problem that I recommend you check out. First off, you aren't using the Option Explicit declaration at the top of each module. Because of this you are using a global variable on one of your forms that doesn't exist.

At the top of your forms you should have:
CODE
Option Compare Database
Option Explicit


In case you don't already know, it is a best practice to frequently run the Compile Database option which is located on the debug menu in the VBA editor. It's also good to run Compact and Repair occasionally. However, neither of things will fix the problem you're currently having.
hawk7890
Thank you

I will do the change suggested. You mentioned that I am using a global variable that doesn't exist, which variable are you reffering to? I have 3 variables called gfullname, gusername, guserrights. Those are actually in use on the welcome form, I just hard coded a value in them in order not to generate an error when I upload it for assistance.

Thanks
Marc
hk1
I think the one that was missing in mdlUser was gUserRights.

This is all I saw in there:
CODE
Public gFullName As String
Public gAccessType As String
Public gLoginName As String


If you use the Option Explicit statement in all of your modules it will help you avoid this problem since it prevents you from using a variable which has not been declared.
hawk7890
Thank you, I see where I did the mistake and resolved it.

Any chance someone could assist with the other questions I listed? I am really stumped with those.

thanks
Marc
hk1
Here it is. I just followed the instructions that missinglinq posted above.
hawk7890
Yes the fix that missinglink posted worked. I was wondering if anyone is able to assist me with some code for the following that I would like to accomplish.
The codes would be on frmLoanEdit
First, when you use frmLoanSearch and search an asset (say C3333), frmLoanEdit opens on that loan record. Can you assist with the following?

-Display the asset number and asset details in controls that do not have scrollbars
-OtherEquipmentLoanSubform: not sure how to build this, the idea is that all the items are listed, and when a client borrows a piece of equipment, you put a check for yes or no.
-When ExtendedReturnDate field is changed it automatically changes the setting of extended to yes, it also calculates to ensure the difference between initial loandate and entered date is no more than 20 days
-When callback done button is pressed it adds todays date and the name of the currentuser

Thanks
Marc

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.