Winterwolf73
New member
- Local time
- Today, 12:27
- Joined
- Jul 3, 2020
- Messages
- 26
Ok everyone. I am going to apologize now. I am extremely new to VBA coding. I have gotten to the point of banging my head off a brick wall. I found this bit of code that I think will work to get to my end goal. I have a number of unbound user defined text boxes. Here is what I am trying to do.
1. I have a form which has tabbed pages added to it. The first page is a customer look up (which works fine because it is using a query with the "Like" criteria in place.
2. The second tab is for added a new customer to the table. Below is the code I have in place on the button to add the record.
Code Tags Added by UG
Please use Code Tags when posting VBA Code
Please read this for further information:-
https://www.access-programmers.co.u...e-use-code-tags-when-posting-vba-code.240420/
Please feel free to Remove this Comment
Originally, instead of "Me.Label5" it was "Me.Label5.Value". However, every time I attempted to test it i received a "Method or Data Member not found" error. So I did some more research. I decided to take out the .Value to see if that was the problem. Now I get a Run-Time 438 error.
Any assistance you can give would be GREATLY appreciated.
1. I have a form which has tabbed pages added to it. The first page is a customer look up (which works fine because it is using a query with the "Like" criteria in place.
2. The second tab is for added a new customer to the table. Below is the code I have in place on the button to add the record.
Code Tags Added by UG
Please use Code Tags when posting VBA Code
Please read this for further information:-
https://www.access-programmers.co.u...e-use-code-tags-when-posting-vba-code.240420/
Please feel free to Remove this Comment
Code:
Private Sub NewCustomer_Click()
Dim tblCustomers As DAO.Recordset
Set tblCustomers = CurrentDb.OpenRecordset("SELECT * FROM [Customer Table]")
tblCustomers.AddNew
tblCustomers![Last Name] = Me.Label5
tblCustomers![First Name] = Me.Label7
' tblCustomers![Account Number] = Me.AccountNumber
' tblCustomers![Project] = Me.Project
' tblCustomers![Project Total] = Me.ProjectTotal
' tblCustomers![Address] = Me.Address
' tblCustomers![City] = Me.City
' tblCustomers![State] = Me.State
' tblCustomers![Zip] = Me.ZipCode
' tblCustomers![Phone Number] = Me.PhoneNumber
' tblCustomers![Email Address] = Me.EmailAddress
tblCustomers.Update
tblCustomers.Close
Set tblCustomers = Nothing
DoCmd.Close
End Sub
Originally, instead of "Me.Label5" it was "Me.Label5.Value". However, every time I attempted to test it i received a "Method or Data Member not found" error. So I did some more research. I decided to take out the .Value to see if that was the problem. Now I get a Run-Time 438 error.
Any assistance you can give would be GREATLY appreciated.
Last edited by a moderator: