473,668 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Compile Error: Expected Function or Variable

72 New Member
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 9005
Dököll
2,364 Recognized Expert Top Contributor
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
1396
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
5675
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
2347
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, upon looking at the example i understand why it fails to link but don't understand why it even compiles. Here's the code, which split between 2 files Def.cpp and Use.cpp: //File Def.cpp
4
13603
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
11323
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 Error Expected: (" eventhough I have the '(' in there. Sometimes it expects a '=' symbol instead, wanting me to bind the call to some variable I guess. What should I do? The function I'm calling does not return any parameters. Here is my code: ...
5
5039
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
6352
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 : $ ../glibc-2.5/configure --prefix=/mnt/new/Mars/glibc_HQ_test/GLIBC/ install/ --with-__thread --enable-kernel=2.6.11 --enable-shared
3
3988
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; using std::cout; using std::endl;
0
1512
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 variable) for my .find method. I have checked the format of this statement and it appears correct...? Dim ItemNumberWLO As String Dim ItemNumberWLN As String While Not WLO.EOF
0
8374
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8890
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8791
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8653
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2018
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1783
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.