Access Visual Basic Code for concatenating multiple fields (text and numbers together) -



Access Visual Basic Code for concatenating multiple fields (text and numbers together) -

i have been set task of creating microsoft access database store client feedback , generate printable study when negative feedback logged.

on feedback form users can log feedback details, trying develop code concatenate fields taken feedback table (which form's record source set to). aiming develop unique number made of next fields feedback table:

company name (this lookup field in feedback table looks company name in company table hence combo-box on form - appears drop downwards menu on form) product name 2 digits of week number 2 digits of month 2 digits of year (these 3 date items extracted field called feedback date in feedback table). a sequential number starting 1 increments if piece of feedback logged on same product same company number changes 2 , on.

basically, illustration i'm wanting replicate this: company name_product name_0712131

the output of these concatenated fields meant stored in field in feedback table called cf#.

what kind of code should writing info want concatenated gets saved database?

there many different ways add together record (currentdb.execute({sql code}), ado commands, dao commands, docmd.openquery), suspect want know how create look going add:

dim strcustomerref string 'add company name (assumes name in sec column) strcustomerref = me.cboyourcombobox.column(1) 'add product name (assumes have text box bound product) strcustomerref = strcustomerref & "_" & me.txttheproductnametextbox 'add date info (assumes have text box bound date) strcustomerref = strcustomerref & "_" & format(me.txtfeedbackdate, "wwmmyy") 'add sequence number strcustomerref = strcustomerref & "_" & dcount("customerref", "cf#", "[customerref] '" & strcustomerref & "*'") + 1 'code append record here currentdb.execute "insert [cf#] ([customerref], [moredata]) values ('" & strcustomerref & "', '" & me.txtmoredata & "')

ms-access

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -