Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error selecting specific record 1

Status
Not open for further replies.

paulminne

Programmer
Nov 27, 2002
80
AU
hi,

I have a form with a button on it. On the click event of the button, an input box appears where a date is inputted by the user.

I am trying to match a specific record from a query where the "JobDate" entered is the same as the JobDate from a record in the query. However I am getting an error stating 'no value given for one or more of the required parameters'.

This is the code:

**********************************
Private Sub cmdWeekly_Click()

On Error GoTo Err_cmdWeekly

Dim strMsg As String
Dim strInput As String
Dim db As Database
Dim rs As ADODB.Recordset
Dim strSQL As String

Set rs = New ADODB.Recordset

rs.ActiveConnection = CurrentProject.Connection

stDocName = "WeeklyJobs"

strMsg = "Please enter the week commencement date! (dd-mmm-yyyy)"
strInput = InputBox(prompt:=strMsg, Title:="Gammasonics - Compliance Database", _
xPos:=2000, yPos:=2000)
stLinkCriteria = "[JobDate]=" & strInput

strSQL = "SELECT * FROM JobsBooked2 WHERE Job.JobID = " & _
strInput

Set db = CurrentDb

'Open the recordset
rs.Open strSQL

If rs.EOF Then
MsgBox "There are no jobs for this date"
Else
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

Exit_cmdWeekly:
Exit Sub

Err_cmdWeekly:
MsgBox Err.Description
Resume Exit_cmdWeekly

End Sub

***************************************

Any help as to why I am getting this error is appreciated.

- Paul
 
in the line:
strSQL = "SELECT * FROM JobsBooked2 WHERE Job.JobID = " & _
strInput

JobID should of been JobDate.

regards,

- Paul
 
You need to change your SQL statement to this:

stLinkCriteria = "[JobDate]= #" & strInput & "#"

strSQL = "SELECT * FROM JobsBooked2 WHERE " & stLinkCriteria
 
Thankyou so much for you help...this worked great.

You cant comprehend how much frustration this little query was giving me..

Regards,

- Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top