Error 3075 - cant find the solution to why i get this error

behedwin

Active Member
Joined
Dec 10, 2014
Messages
399
Hi

My database launches SelecProfile_Form when it starts.
Then i run this code

Code:
Application.Echo False

If Form_SelectProfile_Form.Dirty Then Form_SelectProfile_Form.Dirty = False
If Not IsNull(Form_SelectProfile_Form.txtProfile_ID) Then
DoCmd.OpenForm "Profile_Form", , , "Profile_ID = " & Form_SelectProfile_Form.ListPicker
End If

If Me.Dirty Then Me.Dirty = True
DoCmd.Close acForm, Me.Name

ProfileEffects_Read

Application.Echo True
When double clicking on a listbox row.

Then my profile_form opens

Then i run this code
Code:
Private Sub TjanstFordelning_Button_Click()
Application.Echo False


If Me.Dirty Then Me.Dirty = False
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "UndervisningsTid_Form"
Form_SelectProfile_Form.ListPicker.Requery

Application.Echo True
End Sub
and directly this code
Code:
Private Sub txtCloseSave_Button_Click()
Application.Echo False


If Me.Dirty Then Me.Dirty = True
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "Profile_Form"
Forms!Profile_Form.Requery


Application.Echo True
End Sub
and this code
Code:
Private Sub Close_button_Click()
Application.Echo False

If Me.Dirty Then Me.Dirty = False
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "SelectProfile_Form"
Form_SelectProfile_Form.ListPicker.Requery

Application.Echo True
End Sub

then i run the first code again (double click the listbox)
and i get this error message

screenshot: http://prntscr.com/he4jkc
Error 3075 SYNTAXERROR on profile_id
If i go to the code, excel highligths this row

Code:
Private Sub ListPicker_DblClick(Cancel As Integer)
Application.Echo False

If Form_SelectProfile_Form.Dirty Then Form_SelectProfile_Form.Dirty = False
If Not IsNull(Form_SelectProfile_Form.txtProfile_ID) Then
[I][B]DoCmd.OpenForm "Profile_Form", , , "Profile_ID = " & Form_SelectProfile_Form.ListPicker[/B][/I]
End If

If Me.Dirty Then Me.Dirty = True
DoCmd.Close acForm, Me.Name

ProfileEffects_Read

Application.Echo True
End Sub

i only get this error if i go from form selectprofile_form opens a profile to profile_form
go the button that opens undervisningstid_form
close that form and then close profile_form
and try to open the profile again.

if i skip opening undervisningstid_form i do not get this error atall.



Please help me find the error so i can correct it.
If you want my project file, let me know and ill upload it.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I did some reading on this... still cant figure out why. However i think it might have something to do with my if dirty lines in the code. But i dont understand why... very frustrating this is.
 
Upvote 0
What data type is the field Profile_ID?
 
Upvote 0
What's the value of Form_SelectProfile_Form.ListPicker when you get the error?

Does it have a value?
 
Upvote 0
What's the value of Form_SelectProfile_Form.ListPicker when you get the error?

Does it have a value?

Is there a special way to check what value this have when the error happens?

The value of Form_SelectProfile_Form.ListPicker
is the selected row in a listbox. ListPicker = listbox.
It is placed in selectprofile_form.

The error occurs when i try to doubleclick a row in ListPicker
So it should have the value of the row i click on.

Strange thing is that it works to doubleclick when i start the form....
doubleclick = opens profile_form
if i directly close the profile_form with this code
Code:
Private Sub Close_button_Click()
Application.Echo False

If Me.Dirty Then Me.Dirty = False
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "SelectProfile_Form"
Form_SelectProfile_Form.ListPicker.Requery

Application.Echo True
End Sub
I can directly doubleclick Listpicker again.



But if i doubleclick listpicker and open the profile_form
then click on this button in profile_form to open UndervisningsTid_Form
Code:
Private Sub TjanstFordelning_Button_Click()
Application.Echo False


If Me.Dirty Then Me.Dirty = False
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "UndervisningsTid_Form"
Form_SelectProfile_Form.ListPicker.Requery

Application.Echo True
End Sub

and then this button to close UndervisningsTid_Form and go back to Profile_Form
Code:
Private Sub txtCloseSave_Button_Click()
Application.Echo False


If Me.Dirty Then Me.Dirty = True
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "Profile_Form"
Forms!Profile_Form.Requery


Application.Echo True
End Sub

and lastly click on this button in Profile_Form
Code:
Private Sub Close_button_Click()
Application.Echo False

If Me.Dirty Then Me.Dirty = False
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "SelectProfile_Form"
Form_SelectProfile_Form.ListPicker.Requery

Application.Echo True
End Sub

Then i can not doubleclick on ListPicker
then i get this error (first post)
But if i close all forms and open SelectProfile_Form again, then Listpicker works.....

So something happens when i enter UndervisningsTid_Form and go back to Profile_Form and SelectProfile_Form

But i have no clue what
 
Upvote 0
When you get the error is there a 'debug' option on the error dialog box?

If there is press it, open the Immediate Window (CTRL+G) and enter this.
Code:
? Form_SelectProfile_Form.ListPicker

That should output the value of Form_SelectProfile_Form.ListPicker.

PS You might need to add .Value after Form_SelectProfile_Form.ListPicker.
 
Upvote 0
When you get the error is there a 'debug' option on the error dialog box?

If there is press it, open the Immediate Window (CTRL+G) and enter this.
Code:
? Form_SelectProfile_Form.ListPicker

That should output the value of Form_SelectProfile_Form.ListPicker.

PS You might need to add .Value after Form_SelectProfile_Form.ListPicker.

that worked, it gave me the result "null"
so i guess Listpicker in this situation does not have a value

i want to try something. but dont know how
i guess for some reason the listpicker dont get a value since the listbox is already selected....
how do i reset the form or unselect the listbox so i need to reselect a new row to doubleclick?
 
Upvote 0
Is there definitely something selected in the listbox?
 
Upvote 0
Is there definitely something selected in the listbox?

Yes im very sure something is selected.

I added the following to the doubleclick function of listpicker.

Code:
Private Sub ListPicker_DblClick(Cancel As Integer)
Application.Echo False

If Form_SelectProfile_Form.Dirty Then Form_SelectProfile_Form.Dirty = False
If Not IsNull(Form_SelectProfile_Form.txtProfile_ID) Then
[B]If ListPicker.ListIndex = -1 Then
Exit Sub
Else[/B]
DoCmd.OpenForm "Profile_Form", , , "Profile_ID = " & Form_SelectProfile_Form.ListPicker
[B]End If[/B]
End If

If Me.Dirty Then Me.Dirty = True
DoCmd.Close acForm, Me.Name

ProfileEffects_Read

Application.Echo True
End Sub

This did not work.
I still get the same error when i double click the listpicker row
if i have opened the profile_form and the undervisningstid_form
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,953
Members
448,535
Latest member
alrossman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top