shobhanauto
New member
- Local time
- Today, 11:43
- Joined
- Dec 17, 2023
- Messages
- 17
Someone help me. I am trying hard, but the SMS is not going through.
In my database, there is a Customers table.
MobileNumber = MobileNumber
Customer name = CompanyName
I GOT ERROR
' Assuming CustomerID is a control on the form
Dim CustomerID As Long ' Ensure this matches the data type of CustomerID
CustomerID = Me.CustomerID.Value ' Access CustomerID directly from the form
' Use DLookup to retrieve customer mobile number and company name from Customers table based on CustomerID
customerMobile = DLookup("MobileNumber", "Customers", "CustomerID = " & CustomerID) ' For numeric CustomerID
companyName = DLookup("CompanyName", "Customers", "CustomerID = " & CustomerID) ' For numeric CustomerID
' Display the retrieved values
MsgBox "Customer Mobile: " & customerMobile
MsgBox "Company Name: " & companyName
' Check if the mobile number is valid
If IsNull(customerMobile) Or customerMobile = "" Then
MsgBox "Mobile number not found for this customer.", vbExclamation
Exit Sub
End If
' Check if company name is valid
If IsNull(companyName) Or companyName = "" Then
MsgBox "Company name not found for this customer.", vbExclamation
Exit Sub
End If
In my database, there is a Customers table.
MobileNumber = MobileNumber
Customer name = CompanyName
I GOT ERROR
' Assuming CustomerID is a control on the form
Dim CustomerID As Long ' Ensure this matches the data type of CustomerID
CustomerID = Me.CustomerID.Value ' Access CustomerID directly from the form
' Use DLookup to retrieve customer mobile number and company name from Customers table based on CustomerID
customerMobile = DLookup("MobileNumber", "Customers", "CustomerID = " & CustomerID) ' For numeric CustomerID
companyName = DLookup("CompanyName", "Customers", "CustomerID = " & CustomerID) ' For numeric CustomerID
' Display the retrieved values
MsgBox "Customer Mobile: " & customerMobile
MsgBox "Company Name: " & companyName
' Check if the mobile number is valid
If IsNull(customerMobile) Or customerMobile = "" Then
MsgBox "Mobile number not found for this customer.", vbExclamation
Exit Sub
End If
' Check if company name is valid
If IsNull(companyName) Or companyName = "" Then
MsgBox "Company name not found for this customer.", vbExclamation
Exit Sub
End If