cigarprofiler
Registered User.
- Local time
- Today, 07:46
- Joined
- Mar 25, 2017
- Messages
- 32
Like my wife, Access doesn't understand me. In case of my wife, it usually means I'm doing something wrong, but with Access too?
Here's what I'm trying to do:
1. Retrieve an ID from table1 (pending_review)
2. Use that ID to retrieve a corresponding value from table2 (pending_model)
Part one works fine, part 2 not so much. What am I doing wrong? I get a 3070 runtime error at the bolded line, even though at the underlined portion, I can see (by hovering the mouse over it) that the correct ID has been retrieved. In my mind, that means pending_review is a valid expression but I guess that's not how Access's mind works...
I found what looks like the same question here but applying this syntax gives me a 3464 data type mismatch, even if I Dim pending_review as String:
rs.FindFirst "[reviewid] = '" & pending_review & "'"
What am I doing wrong (apart from dabbling in VBA with no solid knowledge of the language)?
Here's what I'm trying to do:
1. Retrieve an ID from table1 (pending_review)
2. Use that ID to retrieve a corresponding value from table2 (pending_model)
Part one works fine, part 2 not so much. What am I doing wrong? I get a 3070 runtime error at the bolded line, even though at the underlined portion, I can see (by hovering the mouse over it) that the correct ID has been retrieved. In my mind, that means pending_review is a valid expression but I guess that's not how Access's mind works...
I found what looks like the same question here but applying this syntax gives me a 3464 data type mismatch, even if I Dim pending_review as String:
rs.FindFirst "[reviewid] = '" & pending_review & "'"
What am I doing wrong (apart from dabbling in VBA with no solid knowledge of the language)?
Code:
If txt_frm_name = "frm_start" Then 'Interrupted flow
Dim pending_review As Long
Dim pending_model As Long
Dim rs As Recordset
'retrieve pending reviewid from local review table
pending_review = DLast("review_id_l", "local_tblreview_items")
Forms!frm_review.txt_reviewid.SetFocus
Forms!frm_review.txt_reviewid.Text = [U]pending_review[/U]
'retrieve corresponding modelid from public review table
Set rs = CurrentDb.OpenRecordset("public_tblreviews", dbOpenSnapshot, dbReadOnly)
[B]rs.FindFirst "[reviewid] = 'pending_review'"[/B]
If rs.NoMatch Then
MsgBox "There is no pending review" 'Nog een uitgang zoeken, lokale tabel alsnog legen.
Else
pending_model = rs!reviewmodelid 'gets the modelid from tbl_reviews
Me.txt_reviewmodelid = pending_model 'puts the modelid in the review form
End If