0

Hello everyone, I currently doing a database project, which is part of my coursework, and I am having some difficulties. So, I am making it in Microsoft Access 2003. In my form, I want have to tabs (Client and Music Store), and I already have 2 tables, for each tab. I have tried a couple of different things, like queries and also SQL, and they write the data, as they should do, to the table. Inside of each tab, I also want to use my own buttons, to go to the previous and next record, and I know they do work, i used Visual Basics (DoCmd.GoToRecord , , acPrevious/DoCmd.GoToRecord , , acNext) in order to make them work. And I also know they're working because, I have written 2 different records the form and I have switched between those two records. Nevertheless, when I closed down the form and opened it back up, I noticed that the records weren't showing up, but they were still saved on my table. I used SQL to make it working, but as I said after opening it up, the records on my table don't show up, this is the code that I've used:

SELECT Client.*, [Music Store].* FROM Client INNER JOIN [Music Store] ON Client.ID = [Music Store].ID;

I used the wizard to do that (the 3 dots next to the "Record Source"), and I also tried a query but it didn't work either, any ideas on how to make it saving and showing up the records when loading the form, I understand a bit of Visual Basics, would be highly appreciated. Thanks Dan08.

1
Contributor
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Dan08
0

Ok I found the solution. So what I did was, I have deleted the Control Source in the Form Properties, then I went on VB and I added:

Private Sub Form_Load()
Dim strRecordSource As String
    strRecordSource = "SELECT Client.* FROM Client;"
    Form.RecordSource = strRecordSource
End Sub
Private Sub TabCtl0_Change()
Dim strRecordSource As String
Dim strRecordSource2 As String
    strRecordSource = "SELECT Client.* FROM Client;"
    strRecordSource2 = "SELECT [Music Store].* FROM [Music Store];"
    If Form.RecordSource = strRecordSource Then
        Form.RecordSource = "SELECT [Music Store].* FROM [Music Store];"
        Form.Refresh
    Else
        Form.RecordSource = "SELECT Client.* FROM Client;"
        Form.Refresh
    End If
End Sub

And now it's working properly, even the buttons. Hope this helps someone, with the same problem. Dan08

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.