Hayley Baxter
Registered User.
- Local time
- Today, 09:43
- Joined
- Dec 11, 2001
- Messages
- 1,607
I'm sure this is a really simple problem and the code is working. Basically what it does is user checks a check box to archive a contract to another database then up pops a message box to confirm this
Here is the code:
Private Sub CmdMove_Click()
On Error GoTo Err_CmdMove_Click
Dim vSupplierID As String
Dim vOrderNo As String
Dim vContractTypeID As String
Dim Msg, Style, Title, Response, MyString
vSupplierID = DLookup("[Supplier ID]", "QryConfirmation")
vOrderNo = DLookup("[Order No]", "QryConfirmation")
vContractTypeID = DLookup("[ContractTypeID]", "QryConfirmation")
Msg = "You are about to cancel and archive the Contract for:" & Chr(13) & Chr(13) & vSupplierID & Chr(13) & vOrderNo & Chr(13) & vContractTypeID & Chr(13) & "Do you want to continue ?"
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Please Confirm" ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbNo Then
CancelContract.SetFocus
CmdMove.Enabled = False
CmdMove.Caption = "Check the XC check box to move"
CancelContract = 0
Exit Sub
End If
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryAppendContracts"
DoCmd.OpenQuery "qryDeleteContracts"
DoCmd.SetWarnings True
Msg = "You have successfully canceled and archived the contract for:" & Chr(13) & Chr(13) & vSupplierID & Chr(13) & vOrderNo & Chr(13) & vContractTypeID
Style = vbOK + vbCritical + vbDefaultButton1 ' Define buttons.
Title = "Now You Did It ;-)" ' Define title.
Response = MsgBox(Msg, Style, Title)
Forms![frmsearchsuppdetails].Requery
Exit_CmdMove_Click:
Exit Sub
Err_CmdMove_Click:
MsgBox Err.Description
Resume Exit_CmdMove_Click
End Sub
I want it to say you are about to archive = supplier name here, contract no and contract type here instead it grabs the id no instead.
I thought if I put [supplier id].column(2) that may work but it doesn't like it.
Any suggestions?
Thx
Hay
Here is the code:
Private Sub CmdMove_Click()
On Error GoTo Err_CmdMove_Click
Dim vSupplierID As String
Dim vOrderNo As String
Dim vContractTypeID As String
Dim Msg, Style, Title, Response, MyString
vSupplierID = DLookup("[Supplier ID]", "QryConfirmation")
vOrderNo = DLookup("[Order No]", "QryConfirmation")
vContractTypeID = DLookup("[ContractTypeID]", "QryConfirmation")
Msg = "You are about to cancel and archive the Contract for:" & Chr(13) & Chr(13) & vSupplierID & Chr(13) & vOrderNo & Chr(13) & vContractTypeID & Chr(13) & "Do you want to continue ?"
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Please Confirm" ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbNo Then
CancelContract.SetFocus
CmdMove.Enabled = False
CmdMove.Caption = "Check the XC check box to move"
CancelContract = 0
Exit Sub
End If
DoCmd.SetWarnings False
DoCmd.OpenQuery "qryAppendContracts"
DoCmd.OpenQuery "qryDeleteContracts"
DoCmd.SetWarnings True
Msg = "You have successfully canceled and archived the contract for:" & Chr(13) & Chr(13) & vSupplierID & Chr(13) & vOrderNo & Chr(13) & vContractTypeID
Style = vbOK + vbCritical + vbDefaultButton1 ' Define buttons.
Title = "Now You Did It ;-)" ' Define title.
Response = MsgBox(Msg, Style, Title)
Forms![frmsearchsuppdetails].Requery
Exit_CmdMove_Click:
Exit Sub
Err_CmdMove_Click:
MsgBox Err.Description
Resume Exit_CmdMove_Click
End Sub
I want it to say you are about to archive = supplier name here, contract no and contract type here instead it grabs the id no instead.
I thought if I put [supplier id].column(2) that may work but it doesn't like it.
Any suggestions?
Thx
Hay
Last edited: