I'm running into problems populating three tables with information from one form that run 3 lines of INSERT INTO
on an On Click
event in the related form.
I have a form that gets filled out and has a submit button. When the submit button is clicked the information in the form is supposed to populate 3 different tables (code provided below).
The tables are Networks
, Radios
, and Scans
.
Networks
has a primary key of SSID
, which has a one to many relationship with the SSID
field in the Radios
table. The Radios
table has a primary key of BSSID
, which has a one to many relationship with the BSSID
field in the Scans
table. The Scans
table has a primary key called index
that is just an auto-number type all the other fields need to be able to accept duplicates.
When the relationships are intact, only the networks
table gets filled out; but if I remove these relationships then the networks
and scans
table gets filled out, but the Radios
table is still blank.
At this point in time I do not know what the issue is; other than to surmise it has to do with the Radios
table.
Both the form field for BSSID
and the BSSID
field in the Radios
table have a mask of:
AA:AA:AA:AA:AA:AA;
Primary keys are set to required, no zero length for BISSD
, Indexed (no duplicates).
All three tables are empty, so I know there isn't a duplicates issue.
Also, if I fill in the tables in the stated order through the GUI, I have no issues.
This is the code I am using, please keep in mind of the relationships I have stated above. (Also note, if I remove all relationships the Networks
and Scans
tables will populate, but Radios
table WILL NOT populate).
CurrentDb.Execute "INSERT INTO Networks (SSID, Network, Authentication, Encryption)" & "VALUES ('" & Me.txt_SSID & "', '" & Me.cmb_NetworkType & "', '" & Me.cmb_AuthenticationType & "', '" & Me.cmb_EncryptionType & "')"
CurrentDb.Execute "INSERT INTO Radios (BSSID, SSID, [Radio Type], Channel, [Base Rate], [Other Rate])" & "VALUES ('" & Me.txt_BSSID & "', '" & Me.txt_SSID & "', '" & Me.cmb_RadioType & "', '" & Me.txt_Channel & "', '" & Me.txt_BaseRate & "', '" & Me.txt_OtherRate & "')"
CurrentDb.Execute "INSERT INTO Scans ([Scan Date], Location, BSSID, [Signal Strength])" & "VALUES ('" & Me.cmb_ScanDate & "', '" & Me.cmb_ScanLocation & "', '" & Me.txt_BSSID & "', '" & Me.txt_SignalStrength & "')"
My expectation is for all three tables to populate a new record upon the execution of this code.