Qbasicnews.com
May 26, 2020, 04:41:35 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: QUICK mess...  (Read 2650 times)
Angelsknight
New Member

Posts: 1


« on: February 09, 2004, 08:26:17 PM »


I've written a program using Random access files but something's wrong with the execution...I keep getting an error message saying 'Identifier cannot include periods'
 the program line is this-  INPUT "First name";Employee.First     I really dont get the problem, I did everything the way the tutorial taught me... I used the Type...Endtype  and DIM Employee to it  and then opened for RANDOM properly,,, so what's wrong,,, I NEED HELP FASTTT... its for a school project due in a couple of days... PLEASE SOMEONE HELP ME!!!!!
 Sad
Logged

NGEL'S KNIGHT
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #1 on: February 09, 2004, 08:28:45 PM »

could you please give some more of your code (and slow down typing)

edit: the only way i could figure out is that you may have put a period in the Type

WRONG:
Code:
TYPE a.a
a AS STRING * 32
END TYPE

RIGHT:
Code:
TYPE aa
a AS STRING * 32
END TYPE


the wrong one would give you the error specified
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
RST
Wandering Guru
***
Posts: 326



« Reply #2 on: February 09, 2004, 09:01:33 PM »

Are you sure there's no typos with "employee" or "first"? Maybe if you could post the code your using, we could help more....
Logged
Zack
*/-\*
*****
Posts: 3974



WWW
« Reply #3 on: February 09, 2004, 09:12:32 PM »

Quote from: "whitetiger0990"
could you please give some more of your code (and slow down typing)

edit: the only way i could figure out is that you may have put a period in the Type

WRONG:
Code:
TYPE a.a
a AS STRING * 32
END TYPE

RIGHT:
Code:
TYPE aa
a AS STRING * 32
END TYPE


the wrong one would give you the error specified

Or perhaps his TYPE contains a property with a period, as well. I think (not sure) that you can have a type named a.a.
Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #4 on: February 09, 2004, 09:32:16 PM »

@Zack: No you cant have a '.' in the type name. But also (just tested) you cant have a period in the property
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #5 on: February 09, 2004, 09:40:20 PM »

You'll get that error when you haven't DIMmed the Employee as EmployeeType...

Eg:

Code:
TYPE EmployeeType
  First AS STRING * 10  ' First name
  Last AS STRING * 10  ' Last name
END TYPE

' !! Important!!
DIM Employee AS EmployeeType

LINE INPUT "What is your employee's first name? ", dat$

' We have to make dat$ 10 characters long before it will work for Employee.First
FOR I = LEN(dat$) TO 10
  dat$ = dat$ + " "
NEXT I

' Assign the variable
Employee.First = dat$


Off the top of my head, but should work fine.
Logged

whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #6 on: February 09, 2004, 09:48:02 PM »

er. in that code when i take out the 'DIM' you get type mismatch (obviously =p)
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #7 on: February 09, 2004, 09:52:45 PM »

Quote from: "whitetiger0990"
er. in that code when i take out the 'DIM' you get type mismatch (obviously =p)


Oh, you're talking about the error? Well, that's because I'm not doing INPUT "...", Employee.First, I'm doing INPUT "...", dat$. So you would get the error you say in my code, and not the other one Wink
Logged

whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #8 on: February 09, 2004, 10:03:35 PM »

thats a mighty fine substitute  :roll:
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #9 on: February 10, 2004, 01:19:25 AM »

... except you don't get the error cos you wouldn't take the DIM out, would you? Wink
Logged

whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #10 on: February 10, 2004, 01:34:02 AM »

but that doesn't explain what was wrong with the original code
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #11 on: February 10, 2004, 01:36:52 AM »

There was no DIM AS EmployeeType, just a DIM Employee
Logged

KiZ
__/--\__
*****
Posts: 2879


WWW
« Reply #12 on: February 10, 2004, 08:54:12 AM »

Yup, thats correct. I got that problem just yesterday. the period error is related to not DIMing with a type.
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #13 on: February 12, 2004, 01:29:14 PM »

Perhaps you are using it inside a subroutine without using "DIM SHARED" to declare the variable employee.

Could you please share your code?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!