Good morning! I am using Access 2003.
I have written a function called ChangeColour that returns either vbRed, vbYellow or vbGreen. My code is:
Dim x as String
If Not (IsNull(comboProbability.value) Or IsNull(comboImpact.Value)) Then
x =...
Thanks for the help.
For future reference, no one mentioned that you can't do the above in XP Home unless you boot into safe mode and log in as the Administrators (not any administrator).
Hi
I'm running XP on my laptop.
To gain HDD space I bought a new HDD, fitted it and installed XP. The old HDD was fitted into an external USB caddy.
Windows won't let me access the old drive - it lets me into the root and windows directories, but not my old personal folders (under the...
Thank you both.
MajP, I did do what you said - in my second post below the code above is called as a string.
I see what you mean about a query, so if the SQL is not working in the code I can put it directly into a query and debug that way - that makes perfect sense now!
Thanks for your help so far, here's my revised code.
DefectType(0) = Surface
...
For Check2 = 0 To 5
If Me(DefectType(Check2)) <> "-1" Then
NewDefect = "INSERT INTO Defects (Reported, Type, Description)"
NewDefect = NewDefect & "VALUES ('" & ReportDate & "'...
tbh all these quotes are confusing the hell outta me! Thanks for your advice so far.
I will change the Date field to something else
MajP, why is it better (apart from clarity) to phrase SQL statements as variables? I don't understand what you mean, thanks.
Hi
I'm using Access 2000 and DAO.
I have a form with fields that include "Date" and six categories listed as the array "DefectType". Each category has an associated text box with the word "Box" suffixed to the category name.
On submission, I wish to check the contents of the text box for...
Hi
The code below is part on the onclick sub of a form
If Trim(Initals) = "" Then
MsgBox "Please enter your initals in the box", vbOKOnly
Else: CorrectField = CorrectField + 1
End If
The idea is, if the text box Initals is blank, bring up the dialog box, otherwise add one to...
That's great, thank you. This is my first foray into programming since learning C at uni about 15 years ago!
I understand now I don't need the x=MsgBox as long as I remove the brackets.
Could you explain why you've concatenated the null string at the end of the variable and then used Trim...
Thanks for that Remou, it got rid of the error but didn't work! The MsgBox didn't come up if the text box was empty. I managed to sort that as you'll see below though.
Here's revised code:
Option Compare Database
Dim DefectType(0 To 5) As String
DefectType(0) = "Surface"
DefectType(1) =...
Hi
I am a beginner to VBA! I am trying to write a module that checks the content of six unbound text boxes, defined in an array. If the boxes do not contain any content, I wish to prompt the user to enter content. My code is:
Private Sub Submit_Click()
Dim DefectType(0 To 5) As String...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.