End os statement error

June 22, 2017 at 11:18:56
Specs: Windows 7
can you help with end of statement error I read that you put carriage return and line feed and I did this but still getting this error. I'm not sure what immediate window wants here:

Sub make() (&HD), (&HA) &vbcrlf
100 Dim VarX=String (&HD),(&HA)&vbcrlf
110 VarX =(((Nz(DLookup("[NCPDP_ID]", "Main_Credential_Entry_Table", "[NCPDP_ID] = " & [ME.NCPDP_ID]) & "") , "")))) then _ (&HD),(&HA) &vbcrlf
120 & IIf IsNull(VarX) Then DoCmd.OpenForm ("Enter New Credentials")_ (&HA),(&HD)&vbcrlf
130 & Else if (&HD),(&HA)&vbcrlf
140 DoCmd.OpenForm ("Update Existing Credentials")(&HD),(&HA)&vbcrlf
150 End IF (&HD)(&HA)&vbcrlf
End Sub
Private Sub Var create_par_click() (&HD,(&HA)&vbcrlf
170 Dim VarX=String (&HD),(&HA)&vbcrlf
180 Dim VarY=String (&HD),(&HA)&vbcrlf
190 DoCmd.SetParameter ("NCPDP_ID", VarX=Me.Text17)(&HD),(&HA)&vbcrlf
200 DoCmd.SetParameter ("NCPDP_ID" VarX=Me.EnterNewCredentials) (&HD),(&HA)&vbcrlf
210 DoCmd.SetParameter ("NCPDP_ID" VarY=Me.UpdateExistingCredentials)(&HD),(&HA)&vbcrlf
220 DoCmd.SetParameter (OpenForm, Varx=Me.EnterNewCredentials)(&HD) (&HA)&vbcrlf
230 DoCmd.SetParameter (OpenForm, VarY=Me.UpdateExistingCredentials)(&HD),(&HA)&vbcrlf
End Sub
Private Sub Var Load_Form ()(&HD),(&HA)& vbcrlf
240 Dim Shared X As Integer = 200 (&HD),(&HA)&vbcrlf
250 Dim Shared Y As Integer = 200 (&HD),(&HA)&vbcrlf

Private Sub Button1_click sender(By Val sender as System.Object, _ (&HD),(&HA)&vbcrlf
260 & ByVal e As System.Event) Handles Button1.Click (&HD),(&HA)&vbcrlf
270 Var Form2 As Enter New Credentials(&HD)(&HA)&vbcrlf
280 Form2.Visible=True (&HD),(&HA)&vbcrlf

290 Form2.SetDesktpLocation(X, Y)(&HD),(&HA)&vbcrlf
300 X += 30 (&HD), (&HA) Y += 30 vbcrlf (&HD),(&HA),&vbcrlf
310 Y += 30 (&HD), (&HA)&vbcrlf
320 Me.Activate () (&HD),(&HA)&vbcrlf
330 Me.Button1.Enabled=False (&HD),(&HA)&vbcrlf
End Sub
Private Sub Form1_Activated(ByVal Sender As Object, _ (&HD),(&HA)&vbcrlf
& ByVal e As System.EventArgs) Handles MyBase.Activated (&HD),(&HA)&vbcrlf
340 Button1.text="X: & X & X & " Y: " & Y (&HD)(&HA)& vbcrlf
350 Button1.text = "Number of Forms currently Open " & count (&HD),(&HA)&vbcrlf
End Sub

Private Sub Form1_Closed(ByVal Sender as Object,_ (&HD),(&HA)& vbcrlf
& ByVal e As System.EventArga) Hanfles Mybase.Closed _ (&HD),(&HA)&vbcrlf
& Count-=1 (&HD),(&HA)&vbcrlf
End Sub
Private Sub Form1_Load(ByVal Sender As Object, _ (&HD),(&HA)&vbcrlf
& ByVal e As System.EventArgs) Handles MyBase.Load_(&HD),(&HA)&vbcrlf
& Count+= 1 (&HD),(&HA)&vbcrlf
End Sub


See More: End os statement error

Reply ↓  Report •

#1
June 22, 2017 at 11:45:03
Why do you have "(&HD),(&HA)&vbcrlf" on every line? Why do you have line numbers? Neither should be there.

How To Ask Questions The Smart Way

message edited by Razor2.3


Reply ↓  Report •

#2
June 22, 2017 at 13:24:09
that is what msdn said to put to get rid of line number and end of statement errors, but it didn't work

message edited by Erickad


Reply ↓  Report •

#3
June 22, 2017 at 13:26:12
only the line number error went away

Reply ↓  Report •

Related Solutions

#4
June 22, 2017 at 13:33:43
See what msdn said here:

A line terminator divides the characters of a Visual Basic source file into lines. Examples of line terminators are the Unicode carriage return character (&HD), the Unicode linefeed character (&HA), and the Unicode carriage return character followed by the Unicode linefeed character. For more information about line terminators, see the Visual Basic Language Specification.

To correct this error

1.Check to see if two different statements have inadvertently been put on the same line.


2.Insert a line terminator after the element that completes the statement.


Reply ↓  Report •

#5
June 22, 2017 at 14:22:36
Yes, as in the UTF-16/ASCII character with the value of 0xD, and the UTF-16/ASCII character with the value of 0xA. Not whatever you were copy/pasting on every line. Also, compile errors normally have a line number, or point out the line in question. Which line is it complaining about?

How To Ask Questions The Smart Way


Reply ↓  Report •

#6
June 22, 2017 at 14:44:10
I don't know immediate window didn't say, how do I find that out?

Reply ↓  Report •

#7
June 22, 2017 at 14:53:15
Looks like line 110

Reply ↓  Report •

#8
June 22, 2017 at 15:01:43
So the problem is with this line:
110 VarX =(((Nz(DLookup("[NCPDP_ID]", "Main_Credential_Entry_Table", "[NCPDP_ID] = " & [ME.NCPDP_ID]) & "") , "")))) then _ (&HD),(&HA) &vbcrlf

In which case you have more close parenthesis than open parenthesis. You also have "then _" tacked on to the end for some reason.

How To Ask Questions The Smart Way


Reply ↓  Report •

#9
June 23, 2017 at 06:34:42
it could be more lines, how do I get immediate window to show which lines have errors?

Reply ↓  Report •

#10
June 23, 2017 at 06:56:03
Well, any line with "(&HD),(&HA) &vbcrlf" still on it will have an error. That's a given. But besides that, keep trying and keep fixing the problems it brings up.

How To Ask Questions The Smart Way


Reply ↓  Report •

#11
June 23, 2017 at 07:25:10
it also does like line 130 says expecting expression I want else if do the docmd command on the next line

Reply ↓  Report •

#12
June 23, 2017 at 07:27:17
to get rid of end of statement errors do I put the 0xd and 0xa at the end of statement where I am getting the end of statement errors at?

Reply ↓  Report •

#13
June 23, 2017 at 07:36:09
0xD and 0xA are carriage return and new line, respectively. If you were making an editor for VB.NET, that information from MSDN would have meaning. You're not, so it doesn't. Leave the file structure to the editor, and work on the errors the compiler is pointing out.

How To Ask Questions The Smart Way


Reply ↓  Report •

#14
June 23, 2017 at 08:29:57
I am getting end of statement errors, expected ) on every Var statement , expected indentifier and invalid in immediate window these four I need to deal with

Reply ↓  Report •

#15
June 23, 2017 at 09:00:33
And each of those errors should have a line number. If you want me to point out exactly what the compiler's complaining about, post those exact lines, ideally in pre tags so the formatting remains the same.

How To Ask Questions The Smart Way

message edited by Razor2.3


Reply ↓  Report •

#16
June 23, 2017 at 09:03:20
This line Form2.Visible=True is invalid in immediate, how else do I get my form visible?

Reply ↓  Report •

#17
June 23, 2017 at 09:09:28
"Form2" is most likely a class; not an object. You need to create an object from that class, and then you can set that object's visibility. This is something that's generally done by the program at runtime, and not from an immediate window.

I should say this now, but I'm assuming you're using VB.NET, and not VBA, VBS, VB6, or any of the other Visual Basics. Yes, there is a difference. Yes, it is important.

How To Ask Questions The Smart Way


Reply ↓  Report •

#18
June 23, 2017 at 10:49:30
Im in access vba module

Reply ↓  Report •

#19
June 23, 2017 at 10:50:40
I also have expected = error

what's wrong with this statement? DoCmd.SetParameter (OpenForm, VarU=Me.EnterNewCredentials)


Reply ↓  Report •

#20
June 23, 2017 at 11:05:42
oh when I run this code up top not in immediate window it keeps asking me to create a macro and I don't know how to turn this off

Reply ↓  Report •

#21
June 23, 2017 at 11:07:24
it has less error when I click run in the macros but it keeps asking to create other macros

Reply ↓  Report •

#22
June 23, 2017 at 11:11:23
Erickad: Im in access vba module
In which case, what I said doesn't apply. Just know that not everything is possible from Immediate all of the time.

Erickad: what's wrong with this statement?
If you're calling a function and doing something with its return value, you use parenthesis. If it doesn't or you're not, you don't use parenthesis. Also, not sure what you're trying to do here, but if you're not testing to see if VarU is equal to Me.EnterNewCredentials, you're not going to get the desired results.

DoCmd.SetParameter OpenForm, VarU=Me.EnterNewCredentials

How To Ask Questions The Smart Way


Reply ↓  Report •

#23
June 23, 2017 at 11:23:54
I got this code from msdn but it's throwing erros expecting expression, how can I change it around


300 Form2.SetDesktpLocation(X, Y)
320 X += 30
330 Y += 30
340 Me.Activate ()
350 Me.Button1.Enabled=False


Reply ↓  Report •

#24
June 23, 2017 at 11:25:28
I tried X=X=+30 and it didn't take and Y=Y==30 and it didn't take

Reply ↓  Report •

#25
June 23, 2017 at 11:26:42
X=X+=30 and Y=Y+=30 and neither of them worked

Reply ↓  Report •

#26
June 23, 2017 at 11:38:07
Why would my code ask me to keep creating macros what am I doing wrong

Reply ↓  Report •

#27
June 23, 2017 at 11:39:29
Are my setting wrong or something

Reply ↓  Report •

#28
June 23, 2017 at 11:41:50
This code Private Sub MustLook()

Dim SubX As String

SubX = Nz(DLookup("[NCPDP_ID]", "Main_Credential_Entry_Table", "[NCPDP_ID] =" & [ME.NCPDP_ID])& ""),"") then

IIf IsNull(SubX) Then
DoCmd.OpenForm ("Enter New Credentials")
Else
DoCmd.OpenForm ("Update Existing Credentials")
End If
End Sub


Reply ↓  Report •

#29
June 23, 2017 at 11:42:28
Its asking me to create a macro every time I click run

Reply ↓  Report •

#30
June 23, 2017 at 12:06:02
all I want is to look in a field and if the ncpdpid is there open one form and if it isn't there open another form

Reply ↓  Report •

#31
June 23, 2017 at 12:12:48
The end of statement error changed to label or statement or end of statement error

Reply ↓  Report •

#32
June 23, 2017 at 12:46:54
Does anyone have a fix for the above error

Reply ↓  Report •

#33
June 23, 2017 at 13:17:37
Do you think the immediate window will perform the code I have written will it open either of the forms?

Reply ↓  Report •

#34
June 23, 2017 at 13:45:54
I just read the proper way to test functions in immediate window is with a ? should I be testing with a ?

Reply ↓  Report •

#35
June 26, 2017 at 07:11:43
If any can help me figures why this code keeps asking me to create macros I would greatly appreciate it. is it settings or something I can change to get this code working.

This code Private Sub MustLook()
Dim SubX As String

SubX = Nz(DLookup("[NCPDP_ID]", "Main_Credential_Entry_Table", "[NCPDP_ID] =" & [Forms!][Enter New Credentials][NCPDP_ID])& ""),"") then

IIf IsNull(SubX) Then
DoCmd.OpenForm ("Enter New Credentials")
Else
DoCmd.OpenForm ("Update Existing Credentials")
End If
End Sub


Reply ↓  Report •

#36
June 26, 2017 at 07:16:51
This code Private Sub MustLook()
Dim SubX As String

SubX = Nz(DLookup("[NCPDP_ID]", "Main_Credential_Entry_Table", "[NCPDP_ID] =" & [Forms]![Enter New Credentials]![NCPDP_ID]])& ""),"") then

IIf IsNull(SubX) Then
DoCmd.OpenForm ("Enter New Credentials")
Else
DoCmd.OpenForm ("Update Existing Credentials")
End If
End Sub


Reply ↓  Report •

#37
June 26, 2017 at 07:43:33
Var new module()

(VarX = String)

VarX = Nz(DLookup("[NCPDP_ID]", "Main_Credential_Entry_Table", "[NCPDP_ID] =" & [Forms]![Enter New Credentials]![NCPDP_ID])& ""),"") then

IIf IsNull(VarX) Then
DoCmd.OpenForm ("Enter New Credentials")
Else if
DoCmd.OpenForm ("Update Existing Credentials")
End If
Block If
End if


Reply ↓  Report •

#38
June 26, 2017 at 07:44:40
I have the following code in immediate window in Access, all lines have end of statement errors

Reply ↓  Report •

#39
June 26, 2017 at 07:45:45
When I click run in access I get the box asking to create a macro and in Immediate window it say end of statement errors

Reply ↓  Report •

#40
June 26, 2017 at 08:16:30
Ok immediate window is opening the forms I just need it to perform the DLookup function but it keeps saying I have end of statement error

Reply ↓  Report •

Ask Question