Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.
The above code dumps data into the Wt field, then moves to the next record's wt field until it reaches the end and the message " That's the last Cavity in the list. Click Save Cavity Data button." displays. I need to dump data into a Wt field, and automatically move cursor to the right to dump data. I need to move to insert data in 4 horizontal fields for one record and then go to the next record and insert 4 fields again til the end of the list. Let me know if you need more info. Any help would be greatly appreciated.
Function GetWedgeData1() ' Declare variables Dim ChannelNumber, MyData As Variant ' open a link to WinWedge ChannelNumber = DDEInitiate("WinWedge", "Com1") ' get data from field(1) MyData = DDERequest(ChannelNumber, "FIELD(1)") ' terminate the link DDETerminate ChannelNumber ' if no data then quit If Len(MyData) = 0 Then Exit Function 'Data from Field(1) in WinWedge is now in the variable "MyData". The following code sets 'the value of Textbox1 on Form1 to display the current WinWedge data. Forms!T1DryweightForm!textbox1.SetFocus Forms!T1DryweightForm!textbox1.Text = MyData End Function Here is the vb code that is run when data is placed in a textbox1 on my Access form: Private Sub textbox1_AfterUpdate() On Error GoTo ProcError Me.[CavityDataSubfrm].SetFocus Me![CavityDataSubfrm].Form!Wt = textbox1.Value DoCmd.GoToRecord , , acNext ' Do Something for each record ExitProc: Exit Sub ProcError: Select Case Err.Number Case 2105 MsgBox "That's the last Cavity in the list. Click Save Cavity Data button.", _ vbInformation, "End of the list..." Case Else MsgBox "Error " & Err.Number & ": " & Err.Description, , _ "Error in NextPP_Click procedure..." End Select Resume ExitProc End Sub