Unanswered: Update Records from Subform to different Database..with same subform
Much like my last question/problem(http://www.dbforums.com/showthread.php?t=1217406) I'm trying to take a set of hours, that's located on the form I'm using, and updating them to a seperate database that contains the same information on it. Now the hours are located on a subform...
I'm using an INSERT INTO and it works fine...goes through my whole code fine, but when it actually needs to append the new data, it will not append it due to the fact of a type conversion error. Now this should work as it's exactly the same code as I used for a previous button as well..just changed it to pass the horus information. I'm not trying to pass the primary key which is a autonumber..I'm passing everything else.. here's the code used for this button.
Private Sub Command94_Click()
Dim rs2 As DAO.Recordset
Dim sqlSI2 As String
Dim sign2 As Variant
Dim updateHours As DAO.Recordset
Dim updateSQL2 As String
Dim qryData2 As Variant
sqlSI2 = "SELECT * FROM [SERVICE HOURS2] WHERE [SERVICE HOURS2].[ServiceRecordID] =" & Me.[ServiceRecordID] & ";"
Set rs2 = CurrentDb.OpenRecordset(sqlSI2)
Set sign2 = rs2
Have you tried writing an append query that does the same thing? If you can get the append query to work, then there's probably something wrong with your code. If the append query will not work, there's something going on with the data. Make sure each field of the two tables has exactly the same data type (both Long Integer, not just number type), and same length for text fields.
One thing I noticed is that your textbox on your form has the same name as your field name (ServiceRecordID). Even though that's the default name when you create a form, VBA gets confused sometimes. I usually rename the textboxes something like intServiceRecordID for integers, txtField for text fields, etc. You only need to rename the textboxes that are used in code.