help with conditional statements

A

accclt718

hello All
Novice programmer ....

submit job form, with has 4 command buttons,
1) submit job
2) clear job ( which clear all the text on form while its open)
3) print job
4) return main SB (also having a problem Yes or NO option when the user
clicks return to main SB

the database was done by another IT
person who left the comapny
,
any suggestions on YEs or NO statement "return to main Switchboard" statement
would be greatly appreciated

here is the code Submit Job form
Option Compare Database

Private Sub cboCntct_AfterUpdate()

Dim ContactInf As String
Dim rst As DAO.Recordset
ContactInf = "SELECT * FROM Contacts " & " Where ContactName = '" &
Me!cboCntct.Value & "'"
Set rst = CurrentDb.OpenRecordset(ContactInf, dbOpenDynaset)
If rst.EOF = True And rst.BOF = True Then
Call MsgBox("The Contact Name you entered does not exist")
Else
Me!TbxPhone = rst!Telephone
Me!TbxFax = rst!Fax
Me!TbxComp = rst!Company
Me!TbxFloor = rst!Floor
Me!TbxStreet = rst!Street
Me!TbxCityStateZip = rst!CityStateZip
Me!TbxEmail = rst!email
End If

Set rst = Nothing

End Sub

Private Sub cmdClearJob_Click()
If Me.Controls Then
Me.Undo
End If

End Sub

Private Sub FormExit_Click()

DoCmd.Close
DoCmd.SelectObject acForm, "Switchboard"

End Sub

Private Sub Print_Button_Click()
If DLookup("ProjectNumber", "nameProjects", "ProjectNumber=" & Me!ProjNum) =
Me!ProjNum Then
DoCmd.PrintOut acSelection
Else
MsgBox "You Must Submit job First, Before Printing"
End If

End Sub

Private Sub ProjNum_GotFocus()
Dim X As Integer
X = DMax("ProjectNumber", "nameProjects")
Me!ProjNum = X + 1
Me!TbxDateIn = format(Now(), "mm/dd/yyyy")
End Sub

Private Sub SubJob_Click()

Dim QrySQL As String
QrySQL = "INSERT INTO [nameProjects] (ProjectNumber,
SpecialInstructions, ProjectDescription, Consultant, DateIn, FinalDue,
PrimaryFormat, ContactName, Presenter, Company, Floor, Street, CityStateZip,
ExpenseCode, ProjectCode, DepartmentCode, Telephone, email, Fax) SELECT
Forms!JobEFrm!ProjNum AS ProjectNumber, Forms!JobEFrm!TbxNotes AS
SpecialInstructions, Forms!JobEFrm!TbxDescr AS ProjectDescription,
Forms!JobEFrm!cboConsultant AS Consultant, Forms!JobEFrm!TbxDateIn AS DateIn,
Forms!JobEFrm!TbxFnlDue AS FinalDue, Forms!JobEFrm!TbxPF AS PrimaryFormat,
Forms!JobEFrm!cboCntct AS ContactName, Forms!JobEFrm!TbxPres AS Presenter,
Forms!JobEFrm!TbxComp AS Company, Forms!JobEFrm!TbxFloor AS Floor,
Forms!JobEFrm!TbxStreet AS Street, Forms!JobEFrm!TbxCityStateZip AS
CityStateZip, Forms!JobEFrm!TbxExpCo AS ExpenseCode, Forms!JobEFrm!TbxProCode
AS ProjectCode, Forms!JobEFrm!TbxDeptCo AS DepartmentCode,
Forms!JobEFrm!TbxPhone AS Telephone, Forms!JobEFrm!TbxEmail AS email,
Forms!JobEFrm!TbxFax AS Fax"
DoCmd.SetWarnings False
DoCmd.RunSQL QrySQL
DoCmd.SetWarnings True
MsgBox "Job was Submitted"

End Sub

Private Sub TbxDateIn_GotFocus()

End Sub

Private Sub TbxPF_AfterUpdate()
Dim format As String
If TbxPF = "slides" Then
DoCmd.OpenForm "JobESld"
Else
End If
End Sub

Private Sub TbxPF_GotFocus()

End Sub

Private Sub XYZJobSheet_Click()

End Sub
 
A

accclt718

forgot:
clear command does not work...

accclt718 said:
hello All
Novice programmer ....

submit job form, with has 4 command buttons,
1) submit job
2) clear job ( which clear all the text on form while its open)
3) print job
4) return main SB (also having a problem Yes or NO option when the user
clicks return to main SB

the database was done by another IT
person who left the comapny
,
any suggestions on YEs or NO statement "return to main Switchboard" statement
would be greatly appreciated

here is the code Submit Job form
Option Compare Database

Private Sub cboCntct_AfterUpdate()

Dim ContactInf As String
Dim rst As DAO.Recordset
ContactInf = "SELECT * FROM Contacts " & " Where ContactName = '" &
Me!cboCntct.Value & "'"
Set rst = CurrentDb.OpenRecordset(ContactInf, dbOpenDynaset)
If rst.EOF = True And rst.BOF = True Then
Call MsgBox("The Contact Name you entered does not exist")
Else
Me!TbxPhone = rst!Telephone
Me!TbxFax = rst!Fax
Me!TbxComp = rst!Company
Me!TbxFloor = rst!Floor
Me!TbxStreet = rst!Street
Me!TbxCityStateZip = rst!CityStateZip
Me!TbxEmail = rst!email
End If

Set rst = Nothing

End Sub

Private Sub cmdClearJob_Click()
If Me.Controls Then
Me.Undo
End If

End Sub

Private Sub FormExit_Click()

DoCmd.Close
DoCmd.SelectObject acForm, "Switchboard"

End Sub

Private Sub Print_Button_Click()
If DLookup("ProjectNumber", "nameProjects", "ProjectNumber=" & Me!ProjNum) =
Me!ProjNum Then
DoCmd.PrintOut acSelection
Else
MsgBox "You Must Submit job First, Before Printing"
End If

End Sub

Private Sub ProjNum_GotFocus()
Dim X As Integer
X = DMax("ProjectNumber", "nameProjects")
Me!ProjNum = X + 1
Me!TbxDateIn = format(Now(), "mm/dd/yyyy")
End Sub

Private Sub SubJob_Click()

Dim QrySQL As String
QrySQL = "INSERT INTO [nameProjects] (ProjectNumber,
SpecialInstructions, ProjectDescription, Consultant, DateIn, FinalDue,
PrimaryFormat, ContactName, Presenter, Company, Floor, Street, CityStateZip,
ExpenseCode, ProjectCode, DepartmentCode, Telephone, email, Fax) SELECT
Forms!JobEFrm!ProjNum AS ProjectNumber, Forms!JobEFrm!TbxNotes AS
SpecialInstructions, Forms!JobEFrm!TbxDescr AS ProjectDescription,
Forms!JobEFrm!cboConsultant AS Consultant, Forms!JobEFrm!TbxDateIn AS DateIn,
Forms!JobEFrm!TbxFnlDue AS FinalDue, Forms!JobEFrm!TbxPF AS PrimaryFormat,
Forms!JobEFrm!cboCntct AS ContactName, Forms!JobEFrm!TbxPres AS Presenter,
Forms!JobEFrm!TbxComp AS Company, Forms!JobEFrm!TbxFloor AS Floor,
Forms!JobEFrm!TbxStreet AS Street, Forms!JobEFrm!TbxCityStateZip AS
CityStateZip, Forms!JobEFrm!TbxExpCo AS ExpenseCode, Forms!JobEFrm!TbxProCode
AS ProjectCode, Forms!JobEFrm!TbxDeptCo AS DepartmentCode,
Forms!JobEFrm!TbxPhone AS Telephone, Forms!JobEFrm!TbxEmail AS email,
Forms!JobEFrm!TbxFax AS Fax"
DoCmd.SetWarnings False
DoCmd.RunSQL QrySQL
DoCmd.SetWarnings True
MsgBox "Job was Submitted"

End Sub

Private Sub TbxDateIn_GotFocus()

End Sub

Private Sub TbxPF_AfterUpdate()
Dim format As String
If TbxPF = "slides" Then
DoCmd.OpenForm "JobESld"
Else
End If
End Sub

Private Sub TbxPF_GotFocus()

End Sub

Private Sub XYZJobSheet_Click()

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top