Connecting Tech Pros Worldwide Forums | Help | Site Map

how to insert multible values by making one selection from combo box in forms

ddhung@gmail.com
Guest
 
Posts: n/a
#1: Apr 21 '06
how to insert multible values by making one selection from combo box in
forms. any way to code insert SQL in froms??

Jana
Guest
 
Posts: n/a
#2: Apr 21 '06

re: how to insert multible values by making one selection from combo box in forms


Can you give us an example of what you're trying to accomplish? Your
post is a tad vague.

Jana

ddhung@gmail.com
Guest
 
Posts: n/a
#3: Apr 21 '06

re: how to insert multible values by making one selection from combo box in forms


thanks, but i figure out by coding "INSERT INTO" mutibule values when
there is change of selection.

but i have another question, i am very new to access, how can i write i
simple macro function that detect if the data exits, then any changes
should use update sql instead of insert sql, vice versa.

ddhung@gmail.com
Guest
 
Posts: n/a
#4: Apr 21 '06

re: how to insert multible values by making one selection from combo box in forms


a simple sudu code would be like this ,

like sudu code:

var_1 = run sql "select level_id from knowledge where contactid = 1 and
skillid = 2"

if not null(var_1) { run sql "update knowledge set level_id = level_id
where contactid = 1 and skillid = 2" }

else run sql "insert knowledge (contactid, skillid, Level_id) value
(contactid, skillid, level_id) }

end

any help, many thanks

Jana
Guest
 
Posts: n/a
#5: Apr 21 '06

re: how to insert multible values by making one selection from combo box in forms


Try this **aircode**:
var_1 = DLookup("level_id","knowledge","contact_id = 1 and skill_id =
2)
If Not IsNull(var_1) then
DoCmd.RunSQL "update knowledge set level_id = level_id where
contactid = 1 and skillid = 2"
Else
DoCmd.RunSQL "insert into knowledge (contactid, skillid, Level_id)
values (contactid, skillid, level_id)"
End If

Note: If you are getting the values from your open form for your
insert SQL, it will change like this (all one line):
DoCmd.RunSQL "insert into knowledge (contactid, skillid, Level_id)
values (" & Me!contactid & "," & Me!skillid & "," & Me!level_id & ")"

HTH,
Jana

ddhung@gmail.com
Guest
 
Posts: n/a
#6: Apr 21 '06

re: how to insert multible values by making one selection from combo box in forms


THANK YOU SO MUCH!!!!, life savior!!!! :D

Closed Thread