I am trying to work out a process in which a value from the control source in a form gets put into another table. I can go into the details if needed, but for now, here is my problem.
here is the bit of code (I have commented out all but the OpenRecordset stuff):
As you can see I have tried several ways to get this going. The recordset I would like to open and edit is the query dbo_BoxNoQuery. This query is based off a table linked from an SQL database, and has a parameter for LocCode (as you can see with my SELECT statement) which is pulled from another active form (this works as I can see in the debug check)
my last and still active check is to try and open the old BoxNumbers table that is local to this database, and it too fails with error 3078 (can't find the table).:banghead:
Maybe I am going about this wrong, and any help to point me in the right direction would be greatly appriciated.
here is the bit of code (I have commented out all but the OpenRecordset stuff):
Code:
Private Sub CompleteBoxNo_DblClick(Cancel As Integer)
Dim aDB As Database
Dim aRS As Recordset
Dim paramA As String
Dim aRoom As String
Dim aBox As String
aRoom = Me.OfficeNumber.Value
aBox = Me.CompleteBoxNo.Value
paramA = Forms!aMainMenu.ThisLocCode.Value
Debug.Print paramA
Debug.Print aBox
'open the query where the data will be changed
Set aDB = CurrentDb
'Set aRS = aDB.OpenRecordset("dbo_BoxNoQuery", dbOpenDynaset)
Set aRS = aDB.OpenRecordset(BoxNumbers)
'Set aRS = aDB.OpenRecordset( _
'"SELECT * FROM dbo_BoxNumbers WHERE LocCode = " & _
'Forms!aMainMenu.ThisLocCode, dbOpenDynaset, dbSeeChanges)
'aRS.FindFirst "BoxNumber" = aBox
'If aRS.NoMatch Then
' MsgBox "Error", vbCritical, "Error"
'Else
' MsgBox "Good!", vbOKOnly, "Worked"
' Debug.Print aRS.Fields("BoxNumber")
'End If
'Make sure to close the recordset
aRS.Close
End Sub
As you can see I have tried several ways to get this going. The recordset I would like to open and edit is the query dbo_BoxNoQuery. This query is based off a table linked from an SQL database, and has a parameter for LocCode (as you can see with my SELECT statement) which is pulled from another active form (this works as I can see in the debug check)
my last and still active check is to try and open the old BoxNumbers table that is local to this database, and it too fails with error 3078 (can't find the table).:banghead:
Maybe I am going about this wrong, and any help to point me in the right direction would be greatly appriciated.