P
PHisaw
Hi,
I used the following code supplied by Rick Brandt to a message from a 2005
post "Open Forms in Hidden Mode" where user was using one form to open
another form to extract data.
Dim db as Database
Dim rs as Recordset
Dim strSQL as String
strSQL = "SELECT FieldName " & _
"FROM TableName " & _
"WHERE SomeField = SomeValue"
Set db = CurrentDB
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
If rs.EOF = True Then
'No matching records found (do whatever)
Else
'In here values can be extracted by...
SomeVariable = rs!FieldName
End If
rs.Close
Set rs = Nothing
Set db = Nothing
Rick Brandt suggested not using the hidden form but search from table. I'm
trying to do this and keep getting an error. I hope Rick or someone will
help me figure out what I'm doing wrong.
Here's my code below that errors on this line
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
with Run-timer error 3075 - Syntax error (missing operator) in query
expression "tech "FROM tWorkLog WHERE tworklog.tech = "John Smith" and
tworklog.StopTime is Null'.
Dim db As Database
Dim rs As Recordset
Dim strSQL As String
strSQL = "SELECT tech'" & _
"FROM tWorkLog " & _
"WHERE tworklog.tech ='" & Forms!fttswitchboard!CboTech & "'" & _
"and tworklog.StopTime = Null"
Set db = CurrentDb
Debug.Print strSQL
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
If rs.EOF = True Then
DoCmd.OpenForm "fGeninfoTT", , , "jobnumber=" & Me.JobNumber 'No matching
records found (do whatever)
Else
DoCmd.OpenForm "fttWorkLogReminder", , , "tech='" &
Forms!fttswitchboard!CboTech & "'" 'In here values can be extracted by...
'SomeVariable = rs!FieldName
End If
rs.Close
Set rs = Nothing
Set db = Nothing
I've changed the code several different ways, have searched related posts,
changed quotes per related posts and still can't get anything to work. I
would really appreciate any help.
Thanks in advance,
Pam
I used the following code supplied by Rick Brandt to a message from a 2005
post "Open Forms in Hidden Mode" where user was using one form to open
another form to extract data.
Dim db as Database
Dim rs as Recordset
Dim strSQL as String
strSQL = "SELECT FieldName " & _
"FROM TableName " & _
"WHERE SomeField = SomeValue"
Set db = CurrentDB
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
If rs.EOF = True Then
'No matching records found (do whatever)
Else
'In here values can be extracted by...
SomeVariable = rs!FieldName
End If
rs.Close
Set rs = Nothing
Set db = Nothing
Rick Brandt suggested not using the hidden form but search from table. I'm
trying to do this and keep getting an error. I hope Rick or someone will
help me figure out what I'm doing wrong.
Here's my code below that errors on this line
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
with Run-timer error 3075 - Syntax error (missing operator) in query
expression "tech "FROM tWorkLog WHERE tworklog.tech = "John Smith" and
tworklog.StopTime is Null'.
Dim db As Database
Dim rs As Recordset
Dim strSQL As String
strSQL = "SELECT tech'" & _
"FROM tWorkLog " & _
"WHERE tworklog.tech ='" & Forms!fttswitchboard!CboTech & "'" & _
"and tworklog.StopTime = Null"
Set db = CurrentDb
Debug.Print strSQL
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
If rs.EOF = True Then
DoCmd.OpenForm "fGeninfoTT", , , "jobnumber=" & Me.JobNumber 'No matching
records found (do whatever)
Else
DoCmd.OpenForm "fttWorkLogReminder", , , "tech='" &
Forms!fttswitchboard!CboTech & "'" 'In here values can be extracted by...
'SomeVariable = rs!FieldName
End If
rs.Close
Set rs = Nothing
Set db = Nothing
I've changed the code several different ways, have searched related posts,
changed quotes per related posts and still can't get anything to work. I
would really appreciate any help.
Thanks in advance,
Pam