Pestomania
Active Member
- Joined
- May 30, 2018
- Messages
- 332
- Office Version
- 365
- Platform
- Windows
Hi. I am trying to use a VBA code to pull initials from a table named "PlannersList". It will then take those initials and insert them into query "schedule" in the "initials" parameter. This process will loop until all initials have been utilized. Everything works except for the initials are not returning results, but if I take away the table request and just type initials, it works. Below is what I have:
PlannersList Table Fields & Data Type:
Planner - Text
PlannerInitials - Text
DateEdited - Date/Time
Schedule Query Fields:
Initials (Parameter = Like findcriteriaOHREF)
NumberofJobs
VBA:
This returns the query with a
Error as the result but no Error code
I have added * after the variable. I've added "findcriteriaOHREF" but nothing works. The initials are only letters. The type is text but I can't figure out what's going on
Please help!!
PlannersList Table Fields & Data Type:
Planner - Text
PlannerInitials - Text
DateEdited - Date/Time
Schedule Query Fields:
Initials (Parameter = Like findcriteriaOHREF)
NumberofJobs
VBA:
Code:
Option Compare Database
Public Sub ModifyData()
Dim myRST as Recordset
Dim myDB as Database
Dim myGlobalVariableOH_REF as String
Set myDB = CurrentDB
Set myRST = myDB.OpenRecordSet("PlannersList", dbOpemDynaset)
Do Until myRST.EOF
myGlobalVariableOH_REF = myRST!PlannerInitials
DoEvents
Docmd.OpenReport "Schedule"
myRST.MoveNext
Loop
myRST.Closen
End Sun
Public Function findcriteriaOHREF()
findcriteriaOHREF = myGlobalVariableOH_REF
End Function
This returns the query with a
Code:
#Type!
I have added * after the variable. I've added "findcriteriaOHREF" but nothing works. The initials are only letters. The type is text but I can't figure out what's going on
Please help!!
Last edited: