473,383 Members | 2,005 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,383 software developers and data experts.

The argument is not Optional,Acces VBA

Hello, im still beginner in the world of acces and VBA, I was making buttons that could change some details in the database However, after writing the code im getting this message: The argument is not Optional.
--------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdajout_Click()
  2. Dim t As String, code As String, rep As String
  3. Dim req As String
  4. rep = MsgBox("Vous vouler Modifier Un client Telephone", vbYesNo + vbQuestion + vbDefaultButton2, "information")
  5. If rep = vbNo Then
  6. MsgBox "Operation Annulée"
  7. Else
  8. code = InputBox("Entre le client Code")
  9. t = InputBox("Entre un Nouvaux numero")
  10. req = "update Client set Tel='" & t & "' where Cdclt='" & code & "'"
  11. DoCmd.RunSQL
  12. MsgBox "mise Ajour terminer Avec Succes"
  13. End If
  14. End Sub
------------------------------------------------------------------------
A professional will easily see what I'm doing wrong, so please as I said I'm still beginner, thanks
Jan 16 '15 #1
2 1427
Seth Schrock
2,965 Expert 2GB
Please use CODE tags when posting code, per the site's rules.

I believe the error is in your DoCmd.RunSQL line as you don't provide the SQL that needs to be ran. Your code should be
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunSQL req
You might also get an error because of declaring rep as a string. It should be declared as an Integer. Even if you don't get an error on this, you really should change it.
Jan 16 '15 #2
Many thanks,man and sorry about the CODE thing,this was my first question many thanks.
Jan 16 '15 #3

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

Similar topics

2
by: Alan Little | last post by:
Is it possible to make a by-reference argument optional in a UDF? When I try to assign it a default value in the definition, I get a parse error, "unexpected '='". PHP itself has optional by-ref...
0
by: Philip Rittenhouse | last post by:
I have discovered a couple of problems with the way the universal gateway code handles optional parameters and variable argument lists in COM servers. It appears to only be a problem when you...
1
by: Martin Miller | last post by:
In section "3.27 new -- Creation of runtime internal objects" of the documentation that comes with Python 2.4 it says: > instancemethod(function, instance, class) > > This function will return...
4
by: Gerry Abbott | last post by:
Hi All, Im trying to use thie combination but have not had success. Below is the function It tried the following myriskLevel(2,2) myrisklevel(0,0,2) and the ismissing(Three) alwasy...
16
by: ad | last post by:
Does C#2.0 support optional parameters like VB.NET: Function MyFunction(Optional ByVal isCenter As Boolean = False)
3
by: Marco Segurini | last post by:
Hi, Actually I am calling from VB some functions imported from a c++ dll. Some of these functions require as parameter a pointer. Example: extern "C" int DllCall(int * pvInt, int iLen); ...
4
by: Joe HM | last post by:
Hello - I realize that there is no more IsMissing function in VB.NET but how can I have a boolean argument that is optional and in the code I need to determine whether it was passed it or not? ...
4
by: Patient Guy | last post by:
Does anyone have any coding rules they follow when doing argument checking? When arguments fail during check, do you return from the call with an ambiguous return value, or do you throw...
6
by: Rob Hoelz | last post by:
So these two functions are different: void foo(void); and void foo(); because the first one allows no arguments, but the second does. My question is: In the implementation of the...
19
by: Spiros Bousbouras | last post by:
Every time I've seen an example of a variable argument list function its functionality was to print formatted output. Does anyone have examples where the function is not some variation of printf ?
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.