Error during Closing the MS Access application - ms-access

When i am closing the MS access application (application.mde) i am getting a error and looks like database has been refreshed and gettting a some other records.
Error Messaage : The Expression on unload you entered as the event property setting produced error:datatype mismatch in criteria expression.
Kindly help me on it.

the OnFormat property of the form /controls might be set to something other than the string "[Event Procedure]", or may not be named as a valid macro.

Related

Cannot use the "Form" property on a "SubForm" object in MS Access?

I'm trying to fix a problem with a MS Access database (.mdb) which I didn't create and it was working fine on another computer which broke, there is a dropdown to select from a value which should fill a table under the dropdown with the result of a query depending on the value selected, the error is a Run-time error:
Method 'Form' of object '_SubForm' failed
So I clicked on debug, and I got a list of if statements that check for the dropdown value:
If dropdown = 1 Then
Forms!mylist![namelist subform].Form.RecordSource = "SELECT ... ;"
Else
If dropdown = 2 Then
Forms!mylist![namelist subform].Form.RecordSource = "SELECT ... ;"
Else
The error is coming from:
Forms!mylist![namelist subform].Form
I tried to find out the type of the object:
Debug.Print TypeName(Forms!mylist![namelist subform])
it printed SubForm and in the docs there is Form under the SubForm properties, so what could be causing this problem ?
Excuse me if this question is stupid or very easy, but I don't know anything about Visual Basic and everything above I learned today just to fix the problem, so sorry about that.
T think the database is created on MS Access 2003, I tried the database on Access 2003 and 2007 on XP SP3 and Windows 7 and it didn't work, but it worked on Access 2007 on XP SP3 on a computer that I don't have access to anymore.
So what could be causing this problem ? is it a coding problem or am I missing some dependencies ?
When you have a problem with a form, there are various things to check:
Have you got the right names?
Have you tried a compile (Code window, Debug-->Compile)?
Have you compacted and repaired?
Have you decompiled?
Sometimes you may need to recreate the form by copying to text and then importing. (Refer to Application.SaveAsText acForm )
Check for missing references (Code window, Tools --> References). You can get very weird errors totally unrelated to the missing reference.
You should use dot notation here.
And assuming this code runs in the same form, then this should work:
Me.namelist_subform.Form.RecordSource = "select * from qyCustChild"

How to check if an empty record is clicked in an Access subform?

I have a subform embedded in a main form. I have the following code for the onClick event of one field in my subform.
Private Sub my_field_Click()
If Not Me!my_field.Value Is Null Then
'my code here...
End If
End Sub
I want to update a text box with a click on the field, but I got an error when I click the field before the subform is not fully initiated (by setting the field's data source). So I wrote the above code to check if there is any value now in the field. However, I got the run-time error 424: Object required when running this code. Strangely, when I inspect the value of Me!my_field.Value in the debug window at run time, it does give NULL value.
Any idea what went wrong here? What else should I do to do this checking?
I am running this in Access 2000.
Use the IsNull() function in VBA code.
If Not IsNull(Me!my_field.Value) Then

ExcelConnection manager dynamic file path in SSIS

When i tried to give connection string in the form of a variable to "Excel Connection Manager", it gives me the below error.
the connection string format is not valid. it must consist of one or more components of the form x=y seperated by semicolons. This error occurs when a connection string with zero components is set on database connection manager.
Since you want a dynamic file path, when you are setting up the Expression for the Excel Connection Manager, you are probably selecting ConnectionString as a property in the Property Expressions Editor. This results in the error you specified in your question.
What you actually need to select is the ExcelFilePath property. Add your variable in the Expression field afterwards as you would normally do.
You should give us more information. What's the value of you variable when the error pops up? To exactly what property have you assigned this variable?
Anyway, I suspect that you didn't set [Delay validation] property of your connection manager to True - without it ssis check if you connection manager is ok, before you even assign value to the variable (which is dynamic and happens during execution in some loop, I suppose).

How to open a second form based on info from first form?

Could someone please help me with the IF-syntax below?
This is what we need to do:
Add a new record on Form1;
Click a button on Form1 to open Form2;
When Form2 opens, it contains info from Form1.
So, I add this to Properties/OnDirty/CodeBuilder:
If me.Dirty = True then
Me.Dirty = false
Docmd.OpenForm "Form2",,,"EvalID = " & me!Eval_ID
As soon as I enter data, the Docmd line creates a
run-time error 3075, syntax error (missing operator)...EvalID
In Form1 the key is Eval_ID and in Form2 I have EvalID (but not not the key).
Any suggestions?
It looks to me like there are a few things going on here. It would also help to confirm some information:
Is this referring to a MS Access form or some other VBA-driven form?
Are both forms bound to tables or editable queries?
This isn't likely the issue causing the syntax error. It should be simple enough to resolve that. Put a breakpoint in the code at that location. At that point, copy the resulting string (e.g. EvalID = 7) after the word "WHERE" in the SQL view of a new query based on the two tables. Preview the query to debug the cause of the problem with that expression.

Microsoft office can't find the object "A_Z Schaltfläche"

I migrated a database from access 2003 to access 2007.
It seems to work but when I clicked the buttons from A-Z I'm getting this error message:
"Microsoft office can't find the object 'A_Z Schaltfläche'
If 'A_Z Schaltfläche is a new macro or macro group, make sure you have saved it and that you have typed it's name correctly"
I didn't make a new macro but I deleted a word in one of the tables which I think causes the problem: "Like [Formulare]![Frm_Fahrzeugdaten]![Schaltflächenkriterium]"
I found it under the "Record Source" and under one field, that expression is written in the criteria field. If I don't delete this I'm getting a box which says: "Enter Parameter Value" Formulare!Frm_Fahrzeugdaten!Schaltflächenkriterium
My skills in VBA is not really so good, and I need some help how to correct the problem
Thanks for your help.
=======
additional info's:
When I open the VBA code under the Form_Fahrzeugen, here is what I saw:
Private Sub Auswahl_Click()
On Error GoTo Auswahl_Click_Err
' Programmablauf
Me.Filter = "[A_Fahrzeugtyp] like '*'"
Me.Namen_Filter.Value = 27
Me.Schaltflächenkriterium = "*"
Schaltflächenkriterium = "*"
Me.Requery
Me.lfd_Name.Requery
DoCmd.GoToRecord acDataForm, "Frm_Fahrzeugdaten", acGoTo, 1
Me.lfd_Name.Selected(1) = True
Me.A_Inventarnummer.SetFocus
GoTo Auswahl_Click_End
Auswahl_Click_Err:
Call ErrorHandler("Form_Frm_Fahrzeugdaten", "Auswahl_Click", Error$, Err, Erl)
Resume Next
Auswahl_Click_End:
'Ausführungen vor den verlassen der Routine
End Sub
Does it have something to do with the macro name? This is the macro name by the way: "A_Z Schaltfläche"
If I go to the design view of "A_Z Schaltfläche" this is what I got, the conditions are marked yellow I'm not really sure if this is a good sign though:
Thanks
==============
Updates about my problem:
I was able to find the solution of my problem. It was the version of my microsoft office which was causing it. The original database was written in German and when I did the migration, I migrated it to the english version of Access 2007. The reason why it can't find the object because of the name "Ereignisprozedur" in German and "Event procedure" in English. I changed it to Event Procedure because the error says:
"Microsoft Office Access can't find the object "Ereignisprozedur"
If Ereignisprozedur is a new macro or macro group, make sure you have saved it and that you have typed its name correctly
Access was unable to locate the macro or VBA function. If you are trying to call a macro, make sure that the name of the macro and the name of the macro group are spelled correctly.
If you are trying to call a user-defined VBA function, be sure to use the following syntax:
=FunctionName() or =FunctionName(argument1,argument2,...)
Make sure that the function is either:
Defined in the code for the form or report.
- or -
A public function that is in a module (not a class module)."
And the word "Formulare" to Forms. Then the program works.
I can't understand why microsoft programs are language independent???
Do you mean you deleted a word in one of the Queries? What it is is a reference to a form called Frm_Fahrzeugdaten and a control (field, column) called Schaltflächenkriterium. It is under criteria, so the query is saying:
Select such and such where this field (column) is Like this form and this control
It is usual to have
Like "*" & [Formulare]![Frm_Fahrzeugdaten]![Schaltflächenkriterium] & "*"
Or
Like [Formulare]![Frm_Fahrzeugdaten]![Schaltflächenkriterium] & "*"
That is, with wild cards (*)
[Schaltflächenkriterium] seems to me to be the name of an edit control (textbox) in form [Frm_Fahrzeugdaten] for the user to filter a record set.
If you deleted the textbox control, just re-insert it and name it correctly.