473,325 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Compile Error: Expected Function or Variable

72
Hello, i need you help, can someone whats the cause of getting an error of Expected function or variable, its like this i have a function code in a module and call it on my main form.. here my code:
Expand|Select|Wrap|Line Numbers
  1. Function DTR7()
  2.  
  3. Dim rs As New ADODB.Recordset
  4. Dim cnn As New ADODB.Connection
  5. Dim x As Integer
  6.  
  7.         frmMain.Command2.Visible = True
  8.         frmMain.Command1.Visible = False
  9.         frmMain.cboCourse.Enabled = False
  10.         frmMain.cboSemester.Enabled = False
  11.         frmMain.cboYear.Enabled = False
  12.  
  13. 'Enabling Time,Room & Days Option
  14. For x = 0 To 6
  15.      frmMain.Combo1(x).Enabled = True
  16.      frmMain.Combo2(x).Enabled = True
  17.      frmMain.Combo3(x).Enabled = True
  18. Next
  19. 'Enabling Time,Room & Days Option
  20.  
  21. 'Time Connection
  22. If rs.State = adStateOpen Then rs.Close
  23.        rs.Open "Select * from [Time]", cnn, adOpenKeyset, adLockOptimistic
  24.     While rs.EOF <> True
  25.         For x = 0 To 6
  26.          frmMain.Combo1(x).AddItem rs.Fields("Time").Value
  27.         Next x
  28.      rs.MoveNext
  29.     Wend
  30. 'Time Connection
  31.  
  32. 'Room Connection
  33. If rs.State = adStateOpen Then rs.Close
  34.        rs.Open "Select * from [ROOMS]", cnn, adOpenKeyset, adLockOptimistic
  35.   While rs.EOF <> True
  36.     For x = 0 To 6
  37.          frmMain.Combo2(x).AddItem rs.Fields("ROOM").Value
  38.     Next x
  39.   rs.MoveNext
  40.   Wend
  41. 'Room Connection
  42.  
  43. 'Days Connection
  44. If rs.State = adStateOpen Then rs.Close
  45.        rs.Open "Select * from [DAYS]", cnn, adOpenKeyset, adLockOptimistic
  46.   While rs.EOF <> True
  47.     For x = 0 To 6
  48.          frmMain.Combo3(x).AddItem rs.Fields("DAYS").Value
  49.     Next x
  50.   rs.MoveNext
  51.   Wend
  52. 'Days Connection
  53. End Function
  54.  
the highlited part when i debug it is on the word "Function DRT7 ()"

what seems to be a problem here,hope somebody can help me with this. thank you very much...
May 21 '07 #1
1 8963
Dököll
2,364 Expert 2GB
Hello, i need you help, can someone whats the cause of getting an error of Expected function or variable, its like this i have a function code in a module and call it on my main form.. here my code:
Expand|Select|Wrap|Line Numbers
  1. Function DTR7()
  2.  
  3. Dim rs As New ADODB.Recordset
  4. Dim cnn As New ADODB.Connection
  5. Dim x As Integer
  6.  
  7.         frmMain.Command2.Visible = True
  8.         frmMain.Command1.Visible = False
  9.         frmMain.cboCourse.Enabled = False
  10.         frmMain.cboSemester.Enabled = False
  11.         frmMain.cboYear.Enabled = False
  12.  
  13. 'Enabling Time,Room & Days Option
  14. For x = 0 To 6
  15.      frmMain.Combo1(x).Enabled = True
  16.      frmMain.Combo2(x).Enabled = True
  17.      frmMain.Combo3(x).Enabled = True
  18. Next
  19. 'Enabling Time,Room & Days Option
  20.  
  21. 'Time Connection
  22. If rs.State = adStateOpen Then rs.Close
  23.        rs.Open "Select * from [Time]", cnn, adOpenKeyset, adLockOptimistic
  24.     While rs.EOF <> True
  25.         For x = 0 To 6
  26.          frmMain.Combo1(x).AddItem rs.Fields("Time").Value
  27.         Next x
  28.      rs.MoveNext
  29.     Wend
  30. 'Time Connection
  31.  
  32. 'Room Connection
  33. If rs.State = adStateOpen Then rs.Close
  34.        rs.Open "Select * from [ROOMS]", cnn, adOpenKeyset, adLockOptimistic
  35.   While rs.EOF <> True
  36.     For x = 0 To 6
  37.          frmMain.Combo2(x).AddItem rs.Fields("ROOM").Value
  38.     Next x
  39.   rs.MoveNext
  40.   Wend
  41. 'Room Connection
  42.  
  43. 'Days Connection
  44. If rs.State = adStateOpen Then rs.Close
  45.        rs.Open "Select * from [DAYS]", cnn, adOpenKeyset, adLockOptimistic
  46.   While rs.EOF <> True
  47.     For x = 0 To 6
  48.          frmMain.Combo3(x).AddItem rs.Fields("DAYS").Value
  49.     Next x
  50.   rs.MoveNext
  51.   Wend
  52. 'Days Connection
  53. End Function
  54.  
the highlited part when i debug it is on the word "Function DRT7 ()"

what seems to be a problem here,hope somebody can help me with this. thank you very much...
In a previous post with this code, I meant to mention you have ROOMS and ROOM, perhaps that's where the problem is:

Expand|Select|Wrap|Line Numbers
  1.  
  2. frmMain.Combo2(x).AddItem rs.Fields("ROOM").Value
  3.  
  4.  
Jun 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Karol Szkudlarek | last post by:
Hello C++ fans! Why the following program does not compile on my box: typedef int my_int; class A { public:
5
by: cranium.2003 | last post by:
hi, Here is my code #include <iostream.h> int main() { cout <<"HI"; return 0; } and using following command to compile a C++ program g++ ex1.cpp -o ex1
8
by: mastermagrath | last post by:
Hi, I'm about half way through Bruce Eckels thinking in C++ Vol 1. He gives a very short example of how compiler function name decoration helps remove subtle bugs by type-safe linkage. However,...
4
by: Eric Lilja | last post by:
Is this an invalid program? Doesn't compile on my system: #include <cstdio> class Why { enum TArch {LITTLE_ENDIAN, BIG_ENDIAN, NON_IEEE}; TArch Architecture; }; int
5
by: AkiMatti | last post by:
Hi! I'm using MS Access 2002 and have troubles calling my function in a module I've created. When I try to even write the call of the function, it instantly gives me an error saying: "Compile...
5
by: wong_powah | last post by:
#include <vector> #include <iostream> using std::cout; using std::vector; enum {DATASIZE = 20}; typedef unsigned char data_t;
2
by: akhilesh.noida | last post by:
I am trying to compile glibc-2.5 for ARM based board. But I am getting errors while configuring it. Please check and give your inputs for resolving this. configure command : $...
3
by: Hill | last post by:
This is an simple map, just an exercise. Who can help me fix this compile issue?Thanks in advance. #include <string> #include <vector> #include <iostream> using std::vector; using std::string;...
0
by: ppletkov | last post by:
Hi - I apologize if this is a simple question in advance :-) (hopefully it is so its quickly resolved!) i'm trying to figure out why i keep getting an error (Compile Error : expected function or...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shćllîpôpď 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.