|
-
Mar 29th, 2012, 12:36 PM
#1
Thread Starter
New Member
Syntax error
This is the code I am trying to use
vb Code:
Private Sub cmdTryIt_Click()
Dim strEmpFileName As String
Dim strBackslash As String
Dim intEmpFileNbr As Integer
Dim strEmpName As String
Dim intDeptNbr As Integer
Dim strJobTitle As String
Dim dtmHireDate As Date
Dim sngHrlyRate As Single
strBackslash = IIf(Right$(App.Path, 1) = "\", "", "\")
strEmpFileName = App.Path & strBackslash & "EMPLOYEE.Dat"
intEmpFileNbr = FreeFile
Open strEmpFileName For Append As #intEmpFileNbr
strEmpName = ("Enter Name (Or click Cancel to stop):")
Do Until strEmpName = ""
intDeptNbr = InputBox("Enter Debt:")
strJobTitle = InputBox("Enter Job Title:")
dtmHireDate = InputBox("Enter Hire Date:")
sngHrlyRate = InputBox("Enter Hourly Rate:")
Write #intDeptNbr, strEmpName, strJobTitle, dtmHireDate, sngHrlyRate,
Print strEmpName; _
Tab(25); Format$(intDebtNbr, "@@@@"); _
Tab(35); strJobTitle; _
Tab(60); Format$(intDebtNbr, "mm/dd/yyyy); _
Tab(71); Format$(Format$(sngHrlyRate, "Standard"), "@@@@@@@")
strEmpName = InputBox("Enter name (or click Cancel to stop):")
Loop
Close #impEmpFileNbr
End Sub
WHenever I try to run the program error pops up, I receive a syntax error. Can anyone help me understand why I keep getting an error?
Last edited by Hack; Mar 29th, 2012 at 12:39 PM.
Reason: Added Highlight Tags
-
Mar 29th, 2012, 12:41 PM
#2
Re: Syntax error
Moved From The CodeBank (which is for sharing code rather than posting questions )
-
Mar 29th, 2012, 01:04 PM
#3
Thread Starter
New Member
Re: Syntax error
ATTENTION : I am not sandyravage! That peron is in the same class as me and I guess we decided to post the same problem.
Last edited by mrf0272; Mar 29th, 2012 at 01:08 PM.
-
Mar 29th, 2012, 01:19 PM
#4
Re: Syntax error
 Originally Posted by mrf0272
This is the code I am trying to use
vb Code:
Private Sub cmdTryIt_Click()
Dim strEmpFileName As String
Dim strBackslash As String
Dim intEmpFileNbr As Integer
Dim strEmpName As String
Dim intDeptNbr As Integer
Dim strJobTitle As String
Dim dtmHireDate As Date
Dim sngHrlyRate As Single
strBackslash = IIf(Right$(App.Path, 1) = "\", "", "\")
strEmpFileName = App.Path & strBackslash & "EMPLOYEE.Dat"
intEmpFileNbr = FreeFile
Open strEmpFileName For Append As #intEmpFileNbr
strEmpName = ("Enter Name (Or click Cancel to stop):")
Do Until strEmpName = ""
intDeptNbr = InputBox("Enter Debt:")
strJobTitle = InputBox("Enter Job Title:")
dtmHireDate = InputBox("Enter Hire Date:")
sngHrlyRate = InputBox("Enter Hourly Rate:")
Write #intDeptNbr, strEmpName, strJobTitle, dtmHireDate, sngHrlyRate,
Print strEmpName; _
Tab(25); Format$(intDebtNbr, "@@@@"); _
Tab(35); strJobTitle; _
Tab(60); Format$(intDebtNbr, "mm/dd/yyyy); _
Tab(71); Format$(Format$(sngHrlyRate, "Standard"), "@@@@@@@")
strEmpName = InputBox("Enter name (or click Cancel to stop):")
Loop
Close #impEmpFileNbr
End Sub
WHenever I try to run the program error pops up, I receive a syntax error. Can anyone help me understand why I keep getting an error?
You need a quote here:
"mm/dd/yyyy")
-
Mar 30th, 2012, 07:06 AM
#5
Fanatic Member
Re: Syntax error
You are missing the file pointer.
What record within the file are you pointing to ...zero (0).. I guess
Alpha Micro: Alpha Basic, AS400 V5r2, EDI (Trusted Link/ Inovis.com),Access AS/400 via VB6, Qbasic for data conversions. A mix of Hardware too. ASCII Table , New Number to Words/66 digits , AS/400(v5r2) VB6 Viewer/Ask for code(ODBC) ^ What Is Transferring? , Check your Ports #Perfect Passwords , *Slide Bar Example , Logoff, Restart, Shut-Down PC *Keep Form On Top , Opaque Form ^ Create Objects at Run Time @ Check Key Caps Locks # GetTickCount(System Up Time) * Convert text to Excel & Collected Icons + Resize: Form/Text box ^ PC GateWay via Shell $ Drag & Drop Game ! PopUpMenu *Print File/no Open# Timer on Mult Forms ~ Splash & Mult Forms & Lots of Comments + Random/Timer/Guess * Dec >Hex >Oct >Bin % Get MAC (NIC) < saving to Registry > Wookiee Cookies \ BackUpDisk / World Conection SpeedTest $ Glossary Commonly Used Terms # phonetic list @ Detailed Computer Scan
When posting Code, Use tags.. [CODE] *Your Code* [/CODE]
-
Mar 30th, 2012, 01:06 PM
#6
Thread Starter
New Member
Re: Syntax error
Thanks I can't believe I missed that. I guess I dindn't check over my code well enough. I fixed that part now and now whenever I put in the data it asks me It seems to have a prblem with line 29 of the code. (It says Run-time error '13' Type mismatch). I really appreciate the help
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|