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.
 
I believe you are clearing the ID somewhere?
When it errors again, hover over the control for the variable and see what is shown.

That is how I get to correct errors like this.
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,221,645
Messages
6,161,044
Members
451,682
Latest member
ogoreo

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