Invalid Qualifier

JohnnyJones

New member
Local time
Today, 15:30
Joined
Nov 8, 2014
Messages
3
I use access occasionally but wouldnt be the greatest developer. My head is stuck to find out why the Invalid Qualifier error keeps occuring. If anyone could see why that would be a huge help. This is the code, and I've highlighted the line where it says its invalid qualifier:


Private Sub BtnAddBooking_Click()

Dim CustomerID As String
Dim StaffID As String
Dim intPos As Integer
Dim strSQL As String
Dim strSQL2 As String
Dim BathValue As String
Dim rst As DAO.Recordset
Dim RemainingBookingExists As String
Dim RemainingBaths As Integer
Dim RemainingBathsExists As String

If Len(Me.OpenArgs) > 0 Then
intPos = InStr(Me.OpenArgs, "|")

If intPos > 0 Then

CustomerID = Left$(Me.OpenArgs, intPos - 1)
StaffID = Mid$(Me.OpenArgs, intPos + 1)

End If
End If



If DCount("ID", "Remaining_Bookings", "CustomerID=" & CustomerID) > 0 Then
RemainingBookingExists.Value = "Yes"
Else
Set RemainingBookingExists.Value = "No"
End If
 
Take away the value part.
Code:
RemainingBookingExists = "Yes"
and the line in the "Else" part should be, (delete the Set part also):
Code:
RemainingBookingExists = "No"
 
Thank you, that was the issue!
 
I guess RemainingBookingExists is a ChekMark on a form.
Use me.RemainingBookingExists

.Value is the default.
 
I guess RemainingBookingExists is a ChekMark on a form.
Use me.RemainingBookingExists

.Value is the default.
Do you not read the thread before you a giving an answer?

  1. Look at the code in post #1, then you'll recognize that RemainingBookingExists is declared as a String variable and not what you are guessing.
  2. You'll also read the problem is solved!
 
Do you not read the thread before you a giving an answer?

  1. Look at the code in post #1, then you'll recognize that RemainingBookingExists is declared as a String variable and not what you are guessing.
  2. You'll also read the problem is solved!

Yes, I read the thread.
I did not notice it was declared, and using the .Value confused me more.


also, if what is required is Yes/No why not making it into boolean ?
 

Users who are viewing this thread

Back
Top Bottom