sql - How to remove period in Middle Initial ms access -
i have 2 table 1 table need find match on other table.
say have table1 , masterfiles table. table1 has name field same masterfiles.
but table1 name field has different value because has middle initial while masterfiles has middle name.
now want other field value masterfiles called "gender", since table1 has no value on gender field.
the table this:
table1 masterfiles name gender name gender smith, john e. smith, john estaw m canard, donald r canard, donald reever m
since have lot of records in table1 need value of gender field need programmatically.
currently have following code:
dim db database dim rs dao.recordset dim rs2 dao.recordset dim strsql string set db = currentdb set rs = db.openrecordset("table1") while not rs.eof strsql = "select [name], gender masterfiles [name] '%" & me!txtname & "%'" set rs2 = db.openrecordset(strsql) if rs2.recordcount > 0 rs!gender = rs2!gender end if loop
but code not result because of value of name field in table1 has period in middle initial while other row has no period. please refer sample data above. middle initial of "smith, john" has period while "canard, donald" has no period.
so how can query masterfiles , value of gender field , put in table1 gender field?
strsql = "select [name], gender masterfiles [name] '%" & replace(me!txtname,".","") & "%'"
Comments
Post a Comment