Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 19th, 2005, 8:07 AM   #1
gam3r
Newbie
 
Join Date: Jun 2005
Location: London, England
Posts: 24
Rep Power: 0 gam3r is on a distinguished road
need some help with this code

Im doing this for a college project and im not very good at visual basic

Im coding some bits in Access database just little validation rules and stuff but why wont this work? I think there is a problem in the first line of code but im not sure how else i can get it to function withthin these parameters.

Here it is:

Quote:
If [OAP_Benifits] = True And [Booking Day] = "Thursday" And [Bookings.Booking Sesson] = "Morning" Then
MsgBox ("This person is Eligible for OAP Discount Today")
If MsgBox("OAP Special Discount?", vbYesNo, "Information") = vbYes Then
[Fee to Pay] = 7
End If
End If
The error access gives me is
Quote:
Cant find the field "|" reffered to in your expression
Thank you

This coding is in a form btw with a subform
__________________
biggest NOOB ever :P
gam3r is offline   Reply With Quote
Old Dec 19th, 2005, 8:46 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Possibly you misspelled this?
Quote:
[OAP_Benifits]
"Benefits" is correct. No guarantee it isn't misspelled everywhere, though.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Dec 19th, 2005, 10:31 AM   #3
gam3r
Newbie
 
Join Date: Jun 2005
Location: London, England
Posts: 24
Rep Power: 0 gam3r is on a distinguished road
Thanks for replying, i just checked and i have spelt it that way throughout the system so thats not where the error is.

I think i know what it is but i dont know how to get around it. Booking_Day and Bookings.Booking Session is in a subform and i dont know how to address it in the coding. I dont have the help files installed
__________________
biggest NOOB ever :P
gam3r is offline   Reply With Quote
Old Dec 19th, 2005, 10:54 AM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Been a while since I did VB. If no one comes along with an answer in a few hours, I'll drop a suggestion from a faulty memory. I just wouldn't want to mislead you.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Dec 20th, 2005, 6:35 AM   #5
gam3r
Newbie
 
Join Date: Jun 2005
Location: London, England
Posts: 24
Rep Power: 0 gam3r is on a distinguished road
Thank you, i appreciate your help. I don't mind if you give me a wrong solution, i will try it anyway
__________________
biggest NOOB ever :P
gam3r is offline   Reply With Quote
Old Dec 20th, 2005, 8:33 AM   #6
Klipt
Hobbyist Programmer
 
Join Date: Dec 2005
Posts: 118
Rep Power: 0 Klipt is an unknown quantity at this point
I haven't touched VB for years, but how is it you can have variable names with spaces in them? If those are variable names...
Klipt is offline   Reply With Quote
Old Dec 20th, 2005, 10:24 AM   #7
gam3r
Newbie
 
Join Date: Jun 2005
Location: London, England
Posts: 24
Rep Power: 0 gam3r is on a distinguished road
i know that but this is in access so its slightly different those variables are actually field names..
__________________
biggest NOOB ever :P
gam3r is offline   Reply With Quote
Old Dec 20th, 2005, 10:33 AM   #8
lectricpharaoh
Caffeinated Neural Net
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,031
Rep Power: 5 lectricpharaoh will become famous soon enough
Quote:
Originally Posted by gam3r
i know that but this is in access so its slightly different those variables are actually field names..
Not sure about older versions of VB, but in VB.NET, using spaces in your field names will cause problems. The SQL query strings that are created use spaces as a delimiter, so it will make the database queries choke. Use underscores instead, and see if that helps.
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot.
- Vaarsuvius, Order of the Stick
lectricpharaoh is offline   Reply With Quote
Old Dec 20th, 2005, 11:44 AM   #9
gam3r
Newbie
 
Join Date: Jun 2005
Location: London, England
Posts: 24
Rep Power: 0 gam3r is on a distinguished road
Ok i shall try underscores but i don't think its the spaces that are causing the problem because i have other bits of code that work fine with the in

Thank you very much for your help mate.
__________________
biggest NOOB ever :P
gam3r is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:39 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC