Brycey
noobish user :P
- Local time
- Today, 02:18
- Joined
- Apr 21, 2009
- Messages
- 12
Hi guys, Having a bit of trouble with a command button on a form.
I want it to take info entered in a form "Call Logging" and add it to a table "Calls" but it just doesn't wan to work . My current code is:
-----------------------------------------------------------------------
Private Sub Log_Call_Button_Click()
Dim StrMsg As String
Dim intRespons As Integer
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Call Logging"
stLinkCriteria = "[Company]" & Me![Company name]
DoCmd.OpenForm stDocName, , , stLinkCriteria = "[Company]1"
DoCmd.GoToRecord , , acNewRec
StrMsg = "You are about to add a new call to the database:" & vbNewLine & "" & vbNewLine & ""
StrMsg = StrMsg & "Proceed?"
intRespons = MsgBox(StrMsg, vbInformation + vbYesNo)
With Tables![Calls]
If intRespons = vbNo Then
DoCmd.RunCommand acCmdClose
Exit Sub
End If
If .NewRecord Then
.Company_name = Me.[Company]
.Call_Status = Me.[Call Status]
.Engineer = Me.[Engineer]
.Date_Received = Me.[Date Received]
.Job_Description = Me.[Call Descrpition]
.Job_Solution = Me.[Solution Description]
End If
End With
End Sub
------------------------------------------------------------------------
The error that comes up says "Runtime Error 424: Object required" and "With Tables![Calls] is highlighted so guess that's where the problem is but i can't get it lol any help would be greatly appreciated, I've been working on this for too long lol
I want it to take info entered in a form "Call Logging" and add it to a table "Calls" but it just doesn't wan to work . My current code is:
-----------------------------------------------------------------------
Private Sub Log_Call_Button_Click()
Dim StrMsg As String
Dim intRespons As Integer
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Call Logging"
stLinkCriteria = "[Company]" & Me![Company name]
DoCmd.OpenForm stDocName, , , stLinkCriteria = "[Company]1"
DoCmd.GoToRecord , , acNewRec
StrMsg = "You are about to add a new call to the database:" & vbNewLine & "" & vbNewLine & ""
StrMsg = StrMsg & "Proceed?"
intRespons = MsgBox(StrMsg, vbInformation + vbYesNo)
With Tables![Calls]
If intRespons = vbNo Then
DoCmd.RunCommand acCmdClose
Exit Sub
End If
If .NewRecord Then
.Company_name = Me.[Company]
.Call_Status = Me.[Call Status]
.Engineer = Me.[Engineer]
.Date_Received = Me.[Date Received]
.Job_Description = Me.[Call Descrpition]
.Job_Solution = Me.[Solution Description]
End If
End With
End Sub
------------------------------------------------------------------------
The error that comes up says "Runtime Error 424: Object required" and "With Tables![Calls] is highlighted so guess that's where the problem is but i can't get it lol any help would be greatly appreciated, I've been working on this for too long lol